zoukankan      html  css  js  c++  java
  • AutoCAD中static 和 instance class的区别

    using Autodesk.AutoCAD.ApplicationServices;
    
    using Autodesk.AutoCAD.Runtime;
    
    using Autodesk.AutoCAD.EditorInput;
    
    [assembly: CommandClass(typeof(CommandClasses.FirstClass))]
    
    [assembly: CommandClass(typeof(CommandClasses.SecondClass))]
    
    namespace CommandClasses
    
    {
    
      static public class FirstClass
    
      {
    
        private static int counter = 0;
    
        [Autodesk.AutoCAD.Runtime.CommandMethod("glob")]
    
        public static void global()
    
        {
    
          Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    
          ed.WriteMessage("
    Counter value is: " + counter++);
    
        }
    
      }
    
      public class SecondClass
    
      {
    
        private int counter = 0;
    
        [Autodesk.AutoCAD.Runtime.CommandMethod("loc")]
    
        public void local()
    
        {
    
          Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    
          ed.WriteMessage("
    Counter value is: " + counter++);
    
        }
    
      }
    
    }

    Here’s what happens when you execute the two commands in two separate documents:

    [From first drawing...]

    Command: glob

    Counter value is: 0

    Command: glob

    Counter value is: 1

    Command: glob

    Counter value is: 2

    Command: loc

    Counter value is: 0

    Command: loc

    Counter value is: 1

    Command: loc

    Counter value is: 2

    Command: new

    [From second drawing...]

    Command: glob

    Counter value is: 3

    Command: glob

    Counter value is: 4

    Command: glob

    Counter value is: 5

    Command: loc

    Counter value is: 0

    Command: loc

    Counter value is: 1

    Command: loc

    Counter value is: 2

  • 相关阅读:
    li排序
    appendChild的用法
    单选框和下拉框的jquery操作
    Dom操作高级应用
    DOM操作应用
    自己写的sql排序
    odoo10学习笔记七:国际化、报表
    odoo10学习笔记六:工作流、安全机制、向导
    odoo10学习笔记五:高级视图
    odoo10学习笔记四:onchange、唯一性约束
  • 原文地址:https://www.cnblogs.com/swtool/p/8283320.html
Copyright © 2011-2022 走看看