Property Initializer指实例化对象时,调用类的构造方法,用“{}”直接对类的属性进行赋值。

例如:

public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}

Person tom = new Person
{
Name = "Tom",
Age = 10
};

朋友,如果您有什么真知灼见,可以加“新浪微博”/MSN哦,starrycheng@live.com,我们大家一起讨论,一起研究。

最后,帮忙加一分吧,想整个空间系统。

相关文章:

  • 2021-08-08
  • 2021-08-20
  • 2021-12-31
  • 2021-09-30
  • 2021-12-27
  • 2021-09-16
  • 2021-04-19
  • 2022-12-23
猜你喜欢
  • 2021-09-04
  • 2021-12-14
  • 2021-10-19
  • 2022-12-23
  • 2021-10-06
  • 2021-11-09
  • 2021-10-11
相关资源
相似解决方案