Why are my auto-implemented properties working in ASP.NET 2.0?

后端 未结 4 1870
猫巷女王i
猫巷女王i 2021-01-21 06:58

I\'m using the auto-implemented properties syntax in the C# source files of my ASP.NET Web Application:

public int IdUser { get; set; }
...
this.IdUser = 1;
         


        
4条回答
  •  遇见更好的自我
    2021-01-21 07:50

    As @Jakub said, it is backwards compatible. For example you can also use implicitly declared variables (var i = 1; //i is int), though they were also only introduced in C#3.0!

提交回复
热议问题