We have lots of code that has “min” and “max” values for things like prices, profit, costs etc. At present these are passed as two parameters to methods and often have different properties/methods to retrieve them.
I have seen a 101 custom classes to store ranges of values in different code bases over the past few decades, before I create yet another such class, I wish to confirm that the .NET framework these days don’t have such a class built in somewhere.
(I know how to create my own class if needed, but we have too many wheels in this world already for me to just invent anther one on a whim)
This just changed with .Net Core 3.0 see System.Range.
C# 8 also has language support for creating ranges.
See also the "What is Range and Index types in c# 8?" Stackoverflow Question.
Notes these only support ranges of integers, and there is no support for ranges of double or floats.