I am trying to make a struct for a range variable (minimum, maximum) with a few members and a method to know if between values.
Right now my struct looks like this:
public struct NumRange
{
float maximum;
float minimum;
public NumRange(float min, float max)
{
this.maximum = max;
this.minimum = min;
}
public bool IsBetween(float value)
{
if (value < maximum && value > minimum)
return true;
return false;
}
}
I want to be able to make number ranges by
NumRange test = new NumRange(15, 20);
The whole point of making this range variable type is to make a map key dictionary like:
public Dictionary<NumRange, Color> mapKey = new Dictionary<NumRange, Color>();
NumRange test = new NumRange(15, 20);
mapKey.Add(test, Color.Orange);
Is this the best way to go about it? Also it doesn't like when I try to add something to mapKey. Says there is invalid tokens such as ',' ')' '('