在其它语言里,都已了解到。但还是写出来,印象深点。
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace ConsoleApplication2 8 { 9 class Program 10 { 11 enum MyDate 12 { 13 Sun = 0, 14 Mon = 1, 15 Tue = 2, 16 Wed = 3, 17 Thi = 4, 18 Fri = 5, 19 Sat = 6 20 } 21 static void Main(string[] args) 22 { 23 int k = (int)DateTime.Now.DayOfWeek; 24 25 switch (k) 26 { 27 case (int)MyDate.Thi: Console.WriteLine("today is thirday!"); break; 28 } 29 RefernceAndValue.Demonstration(); 30 Console.ReadLine(); 31 } 32 } 33 public class stamp 34 { 35 public string Name { get; set; } 36 public int Age { get; set; } 37 } 38 public static class RefernceAndValue 39 { 40 public static void Demonstration() 41 { 42 stamp Stamp_1 = new stamp { Name = "Premiere", Age = 25 }; 43 stamp Stamp_2 = new stamp { Name = "Again", Age = 47 }; 44 int age = Stamp_1.Age; 45 Stamp_1.Age = 22; 46 stamp guru = Stamp_2; 47 Stamp_2.Name = "Again Amend"; 48 Console.WriteLine("Stamp_1's age:{0}", Stamp_1.Age); 49 Console.WriteLine("age's value:{0}", age); 50 Console.WriteLine("Stamp_2's name:{0}", Stamp_2.Name); 51 Console.WriteLine("guru's name:{0}", guru.Name); 52 } 53 } 54 }