Do I need to use { get; set; } with c# fields that have no special actions when getting and setting

前端 未结 8 1259
借酒劲吻你
借酒劲吻你 2021-01-16 04:59

I have been coding classes like this:

public class ReportViewModel
    {
        public string Status;
        public string DataSource;
        public Stri         


        
8条回答
  •  执念已碎
    2021-01-16 05:16

    They are different: your first two members are fields - not properties. The others are properties with auto-implemented accessors.

提交回复
热议问题