展开全部
c#所有变量都要声明在class内。全局变量可以用静态变量替代。
public class A
{
public static int a;
}
调用时直接用类32313133353236313431303231363533e58685e5aeb931333366306531名,A.a = 1;
宏定义:
[Flags]
enum BuyFlag : uint
{
E_BuyClick = 0,
E_SelectStock,
E_RefPrice,
E_BuyNum,
E_BuyOK_First,
E_BuyOK_Second,
E_WinStartClick,
E_WriteCMD,
E_KillTdxw,
E_CloseCMD,
E_end = 99
}
扩展资料
使用 #define 创建的符号的作用域是在其中定义该符号的文件。如以下示例所示,必须将 #define 指令放在文件顶部。
#define DEBUG
//#define TRACE
#undef TRACE
using System;
public class TestDefine
{
static void Main()
{
#if (DEBUG)
Console.WriteLine("Debugging is enabled.");
#endif
#if (TRACE)
Console.WriteLine("Tracing is enabled.");
#endif
}
}
// Output:
// Debugging is enabled.