- 积分
- 33
- 在线时间
- 3 小时
- 主题
- 1
- 注册时间
- 2021-4-29
- 帖子
- 2
- 最后登录
- 2021-6-5
- 帖子
- 2
- 软币
- 93
- 在线时间
- 3 小时
- 注册时间
- 2021-4-29
|
楼主 |
发表于 2021-5-17 15:20:44
|
显示全部楼层
往前翻书自己找到原理了,“自动实现属性”会隐式创建字段关联属性。
Automatically Implemented Properties—Auto-properties
Because properties are so often associated with backing fields, C# provides automatically implemented
properties, also called auto-implemented properties or, more commonly, just auto-properties, which allow
you to declare the property without declaring a backing field. The compiler creates a hidden backing field for
you and automatically hooks up the get and set accessors to it. |
|