The primary differences between the Maya .NET API and the Maya C++ API are:
Properties instead of getters and setters – Many of the getter and setter functions in the C++ API have been mapped to C# properties. For instance, the methods isInstanceable and setInstanceable of the class MFnDagNode are now exposed as a C# property called isInstanceable (with get and set accessors).
Getter functions are functions that return a value, have no arguments, and that have no observable effect on the state of the application. Getter function names start with the prefix get, is, has, or can; or are qualified as a “const” function in the C++ header files. Setter functions are void functions that have a single argument, start with the prefix set, and that have the same root name as a getter function. Getter functions with a corresponding setter function (same root name) are mapped to read-write properties; otherwise, they are mapped to read-only properties. Properties have the same name as the getter function but with the prefix removed.
In certain cases, the names of the properties had to be changed because the new property name conflicted with an existing method name. The word Property was added to the new property name. For example, index() became indexProperty.
For more information regarding C# properties, see MSDN at http://msdn.microsoft.com/en-us/default.aspx and C# properties.
Events instead of function pointers – The C# event pattern replaces the message registration mechanism of the MMessage derived classes (for example, MSceneMessage, MNodeMessage, and so forth). Therefore, you can register or unregister your callbacks by simply adding or removing them to/from the corresponding event handler of the MMessage derived class.
For instance, do MDagMessage.ParentAddedEvent += callback instead of MDagMessage::addParentAddedCallback(callback).
For the MSceneMessage class, each message identified by a value of the enum Message now has an independent event handler; therefore, the enum is no longer meaningful. For instance, do MSceneMessage.SceneUpdate += callback instead of MSceneMessage::addCallback( MSceneMessage::kSceneUpdate, callback ).
For callbacks related to an instance of an object (MDagPath, MPlug, and so forth), the event handler can be found directly in the class of that object. For instance, do obj.NodeAddedToModel += callback (with obj of type MObject) instead of MModelMessage::addNodeAddedToModelCallback(obj, callback).
To avoid memory leaks, you must deregister your callbacks (by removing them from the corresponding event handler) when the callbacks are no longer needed. A new mechanism has been added to automatically deregister the callbacks when the plug-in is unloaded from Maya.
To see how events are used, refer to the pluginCallbacks example in the devkit\dotnet\examples folder of your Developer Kit installation. For more information on C# events see C# events in MSDN.
Usage of IEnumerable
MDockStation – This is a new class defined to facilitate docking of WPF windows within the Maya UI. In addition, with MDockStation, you can also embed any HWND in Maya (not only WPF's, but for example, a WF window). For more information on WPF controls, see Introduction to WPF in MSDN.