我正在审查一些代码,其中有一个对象初始化模式我不认识 - 有人能告诉我这种模式叫什么(以及在哪里找到使用文档)吗?
obj.myType = (myVar = new MyType());
如果有所影响,具体使用情况如下:
protected MyType myVar;
protected readonly MyComplexType myComplexType;
protected void Page_Init(object sender, EventArgs e)) {
...
myComplexType.myType = (myVar = new MyType());
...
}
get { return fld ?? (fld = new C()); }
。一旦你习惯了这种方式,它就是一种简洁的快捷方式。 - usr