Property vs Function (specifically .NET)

后端 未结 6 2037
花落未央
花落未央 2021-01-12 11:20

I\'ve read some discussions about this subject, and there\'s something I just don\'t understand.

The most common answer seems to be this: use a ReadOnly Property to

6条回答
  •  一生所求
    2021-01-12 12:11

    It is considered bad practice to expose your variable from your class. Plus if you change the structure of your object but keep your properties intact, it won't affect the code that use your class.

提交回复
热议问题