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

前端 未结 11 1209
刺人心
刺人心 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:45

    It's largely just syntactic sugar anyway, so do want you is convention in your team, or what you prefer, as long as it is just returning information about the object and not changing it or interacting with other objects.

提交回复
热议问题