.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Newbie question

2 REPLIES 2
Reply
Message 1 of 3
JeffatSJE
447 Views, 2 Replies

Newbie question

If you load two different modules that have the same named calling method what happens and how do you keep from using the same names from someone else's modules?

 

Curious

J.

 

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: JeffatSJE

I am not sure that I understand your question correctly, but I will give it a try:

 

I think the correct answer for you is : "Namespace"s.  Namespaces are named "categories" for functions and classes in .Net.  By defasult, when you create a new project and give it a name, ex.: "My_Project", visual studio will create for you, in the original files, the namespace "My_Project".  So now, all of the classes and methods that you develop will be in this "namespace".  This allows you to group the elements of your project together and thus allows you to reuse common method names (Ex.: GetMessage()).  When calling a method or accessing and object, you ALWAISE go through the namespace

For exemple:

Autodesk.AutoCAD.DatabaseServices.Circle

Is the full name (inclucing namespace) of a circle object in AutoCAD's .Net API.  So In C#, to create a new circle, you would go:

Autodesk.AutoCAD.DatabaseServices.Circle vCircleObj = new Autodesk.AutoCAD.DatabaseServices.Circle();

 

In this case, this allows AutCAD to have a Circle object, without conflicting with the many "Circle" objects of dfferent .Net namespaces....

 

I won't go further; I suggest you go get some docum. on the subject (MSDN) or go to this site (Autodesk's website : http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1911627) and click to watch the introduction video.  If  am correct, they break down the useage of namespaces for AutoCAD's programmin witch should complee this explainaton.

 

Hope this helps!

Cheers

Message 3 of 3
Anonymous
in reply to: Anonymous

Note that this is only a very basic explaination of namespaces.  There is alot to know (like nested namespaces), but that should get you started!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost