Motivation:
In reading Mark Seemann’s blog on Code Smell: Automatic Property he says near the end:
The bottom line is that au
I think this is a perfectly fine implementation pattern for value types. I've done similar things in the past that have worked out well.
Just one thing, since Celsius
is implicitly convertible to/from int
anyway, you can define the bounds like this:
public const int MinValue = -273;
public const int MaxValue = int.MaxValue;
However, in reality there's no practical difference between static readonly
and const
.