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

  • 相关阅读:
    Redis安装部署
    传输方式Topic和Queue的对比
    Hudson配置及使用
    linux 绿色版 bes 6.6服务安装
    LINUX磁盘管理
    并发用户数与 TPS 之间的关系
    性能测试场景
    计算并发用户数的五种方法
    让selenium自动化脚本运行的更快的技巧
    Jmeter学习
  • 原文地址:https://www.cnblogs.com/swtool/p/8283320.html
Copyright © 2011-2022 走看看