C# shortcut or shorthand getter setter

后端 未结 4 1962
执念已碎
执念已碎 2020-12-29 01:31

Is there a short way to create the getter and setter in c#?

public string fname {get; set;} 

Is there short hand to generate {get; se

4条回答
  •  一向
    一向 (楼主)
    2020-12-29 02:04

    The shortcut is the trigger "prop":

    propintId
    

    and you end up with:

    public int Id { get; set; }
    

提交回复
热议问题