Created
February 22, 2018 21:42
-
-
Save andylshort/c728fc9c6b6085dc5dcd9aa3f4d9b314 to your computer and use it in GitHub Desktop.
Range struct to handle max and min and adapts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Range | |
{ | |
private int _min; | |
public int Min | |
{ | |
get { return _min; } | |
set | |
{ | |
_min = value > _max ? _max : value; | |
} | |
} | |
private int _max; | |
public int Max | |
{ | |
get { return _max; } | |
set | |
{ | |
_max = value < _min ? _min : value; | |
} | |
} | |
public Range(int min, int max) | |
{ | |
_min = min; | |
_max = max; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment