Hello,
Can anyone explain the code line below:
[assembly: CommandClass(typeof(AutoCAD_CSharp_plug_in1.MyCommands))]
In the autocad plugin for visual studio it is written " This line is not mandatory, but improves loading performances"
I realized that, the commandmethod written in different class is not working if this line is used previous to a class.
???
It is a custom attribute, and notice the assembly: at the begining.
So this attribute is applies to the assembly. So instead of searching metadata in all the types in your assembly using this attribute allows the ExtensionLoader just to check at the assembly level which types contain methods to be used as commands.
Say your were assigned the task to get a list of all the rooms in a hotel with a king size bed and blue sheets for 3 hotels.
So there would be no point in the attruibute unless it can skip searching types that do not contain CommandMethods.
So if tell it one type contains commandmethods then you need to tell it all the types that contain commandmethods
So just add the attribute for each type(Class) that contains CommandMethods, you can them class file or in file, etc...
See link for more information
http://spiderinnet1.typepad.com/blog/2012/07/commandclass-and-some-clarifications.html
You do not have to use it, but if you do you must add one for each class that contains CommandMethods.
If your project does not have any CommandClass attributes then the ExtensionLoader will search every class, and will find them if defined in different classes.