mcneel / RhinoCommonTemplatePackage

Source for RhinoCommon V6 plug-in wizard
http://www.rhino3d.com/go/rhinocommon_guide
9 stars 4 forks source link

Use automatic properties for the command/plug-in instances #2

Closed sbaer closed 12 years ago

sbaer commented 12 years ago

The static properties that let you access the singleton instances of the command and plug-in classes should be written as automatic properties. Here's a sample

public class MyPlugIn : Rhino.PlugIns.PlugIn
{
  ///<summary>Gets the only instance of the MyPlugIn plug-in.</summary>
  public static MyPlugIn Instance { get; private set; }

  public MyPlugIn()
  {
    Instance = this;
  }

  // You can override methods here to change the plug-in behavior on
  // loading and shut down, add options pages to the Rhino _Option command
  // and mantain plug-in wide options in a document.
}