C# read-only calculated properties, should they be methods?

前端 未结 11 1191
刺人心
刺人心 2021-01-31 13:55

I have several entities that have calculated fields on them such as TotalCost. Right now I have them all as properties but I\'m wondering if they should actually be methods. Is

11条回答
  •  借酒劲吻你
    2021-01-31 14:39

    I would leave them as properties. But there's not "standard" reason to do things one way or another. If you're by yourself, do whatever you like best. If you're on a team, then follow conventions the rest of your team are following.

提交回复
热议问题