5 ms·
If the field is readonly why did you make the property in the first place? Just do public static readonly BookingTypeId Gold. It's equivalent.
by kevingadd 13y ago
If the field is readonly why did you make the property in the first place? Just do public static readonly BookingTypeId Gold. It's equivalent.
- Locke1689 13y agoIf this is public surface area, the change from field to property is a binary break.
- danbruc 13y ago...and you never know when you might have to add something to the getter. It's the same reason why you usually prefer properties over public fields even if there is no logic in the accessors. Similarly you usually want to expose constants by wrapping them in a read-only property because otherwise the compiler will inline the constant and you can not change it without recompiling all dependencies.