static void Demo6() { Console.WriteLine((int)HosSuportCardType.港澳通行证); Console.WriteLine("============================="); var str = Enum.GetName(typeof(HosSuportCardType), 2); Console.WriteLine(str); Console.WriteLine("=================="); HosSuportCardType hos = new HosSuportCardType(); Console.WriteLine(hos.CustomGetType()); Console.WriteLine(hos.GetType().Name); Console.WriteLine("=============="); List <Student> list = new List <Student> { new Student { Id = 1, Name = "Sun_001", Age = 15 }, new Student { Id = 2, Name = "Sun_002", Age = 17 }, new Student { Id = 3, Name = "Sun_003", Age = 19 } }; var a = list.ToArray(); Console.WriteLine(a); }
public static string CustomGetType(this HosSuportCardType en) { return(en.GetType().Name); }