New

1.运算符

使用对象初始值设定项来简化对象创建
// Object initializer.
var instance3 = new ExampleClass { Name = "Desktop", ID = 37414, Location = "Redmond", Age = 2.3 };

// Default constructor and assignment statements.
var instance4 = new ExampleClass();
instance4.Name = "Desktop";
instance4.ID = 37414;
instance4.Location = "Redmond";
instance4.Age = 2.3;

posted @ 2016-04-27 01:10  楊柳  阅读(140)  评论(0编辑  收藏  举报