C#在构造函数中初始化属性
示例
class Example{
public string Foobar { get; set; }
public List<string> Names { get; set; }
public Example()
{
Foobar = "xyz";
Names = new List<string>(){"carrot","fox","ball"};
}
}
以上是 C#在构造函数中初始化属性 的全部内容, 来源链接: utcz.com/z/321277.html