标签:
/// <summary> /// 对象初始化器测试 /// </summary> public class Initializer { //测试对象初始化器 public static void Test1() { Student stu1 = new Student() { name = "zhangsan", age = 18 }; Console.WriteLine("对象初始化器测试结果:name:{0},age:{1}", stu1.name, stu1.age); Console.ReadKey(); } } //声明一个Student类 public class Student { public string name { get; set; } public int age { get; set; }
}
标签:
原文地址:http://www.cnblogs.com/xiaowei-blog/p/4293845.html