static void Main(string[] args) { StaticVar s1 = new StaticVar(); StaticVar s2 = new StaticVar(); s1.count(); s1.count(); s1.count(); s2.count(); s2.count(); s2.count(); Console.WriteLine("Variable num for s1: {0}", s1.getNum()); Console.WriteLine("Variable num for s2: {0}", s2.getNum()); Console.WriteLine("Variable number for s1: {0}", s1.getNumber()); Console.WriteLine("Variable number for s2: {0}", s2.getNumber()); StaticVar s3 = new StaticVar(); s3.count(); Console.WriteLine("Variable num for s2: {0}", s3.getNum()); Console.WriteLine("Variable number for s3: {0}", s3.getNumber()); Console.ReadKey(); }
static void Main(string[] args) { StaticVar s1 = new StaticVar(); var jsonob = false; Console.WriteLine(jsonob.GetType()); Console.WriteLine(5 & 2); s1.count(); s1.count(); s1.count(); StaticVar s2 = new StaticVar(); s2.count(); s2.count(); s2.count(); Console.WriteLine("Variable num for s1: \n {0}", s1.getNum()); Console.WriteLine("Variable num for s2: \r {0}", s2.getNum()); Console.ReadKey(); /* * infinite loop * for (; ; ) { * Console.WriteLine("Hey! I am Trapped"); * } */ }
static void Main(string[] args) { StaticVar s = new StaticVar(); s.count(); s.count(); s.count(); Console.WriteLine("变量num: {0}", StaticVar.getNum()); }
static void Main(string[] args) { StaticVar s = new StaticVar(); s.count(); s.count(); s.count(); // Console.WriteLine("变量 num: {0}", s.getNum()); 这种写法是错误的 Console.WriteLine("变量 num: {0}", StaticVar.getNum()); Console.ReadKey(); }
static void Main(string[] args) { StaticVar s1 = new StaticVar(); StaticVar s2 = new StaticVar(); s1.count(); s1.count(); s1.count(); s2.count(); s2.count(); s2.count(); Console.WriteLine("s1 的变量num:{0}", s1.getNum()); Console.WriteLine("s2 的变量num:{0}", s2.getNum()); }
static void Main(string[] args) { StaticVar s1 = new StaticVar(); StaticVar s2 = new StaticVar(); s1.count(); s1.count(); s1.count(); s2.count(); s2.count(); s2.count(); Console.WriteLine("Variable num for s1: {0}", s1.getNum()); Console.WriteLine("Variable num for s2: {0}", s2.getNum()); Console.WriteLine("Variable num: {0}", StaticVar.getNums()); Console.ReadKey(); }