Correct use of C# properties

后端 未结 12 667
生来不讨喜
生来不讨喜 2020-12-16 15:19
private List _dates;

public List Dates
{
    get { return _dates; }
    set { _dates = value; }
}

OR

publi         


        
12条回答
  •  無奈伤痛
    2020-12-16 16:04

    Both are basically the same because of how .NET compiles automatic properties. Automatic properties became available with .NET 3.5.

提交回复
热议问题