static void Main(string[] args) { Cat.say(); Cat.say(); Cat.deprecatedMethod(); Cat cat = new Cat(""); MyDelegate m = new MyDelegate(test1); m += test2; m("test"); // cat.color = "assas"; Book book; book.name = "asad"; cat.acceptStruct(book); Console.WriteLine(book.name); double?d = 110d; double c = d ?? 520; Console.WriteLine(c); // 相当于 Nullable <int> n = new Nullable <int>(889); Console.WriteLine(n); /* * Console.WriteLine( "程序!!" ); * * Cat cat1 = new Cat( "maomi" ); * dynamic c1 = cat1; * * Console.WriteLine( c1.getName() ); * Console.WriteLine( cat1.getName() ); * * string str = @"c:\windows......."; * Console.WriteLine( str ); * * string str2 = @"c:\windows....... * adsdsadsadsa * asdsadasd * asdsad"; * Console.WriteLine(str2); * * // 哈哈 C#里面也是有指针的咯!! * try * { * int i = 2; * Boolean b = false; * Boolean.TryParse("true", out b ); // 解析后,将变量赋予b * Console.WriteLine( b ); * // char* c; * // *c = 'a'; * } * catch (Exception e) { * e.ToString(); * } */ // 集合 /* * Hashtable ht = new Hashtable(); * ht.Add("b", "b"); * ht.Add("c", "c"); * ht.GetEnumerator(); */ /** * C#对线程的支持 */ ThreadStart threadStart = new ThreadStart(delegate() { while (true) { Console.WriteLine("我创建了匿名函数"); Thread.Sleep(100); } }); ThreadStart threadStart2 = new ThreadStart(delegate() { while (true) { Console.WriteLine("我创建了匿名函数222"); Thread.Sleep(100); } }); Thread t1 = new Thread(threadStart); Thread t2 = new Thread(threadStart2); t1.Start(); t2.Start(); Console.ReadKey(); }