I have a simple problem: I have a struct Coordinates3D which is basically a 3D Point, but it also checks for boundaries. It has static maxX and minX and so on members, and checks the assigned coordinate value to fit the boundaries. It also has a boolean _check_boundaries, if this is false then it wont check boundaries and allow any values for coordinates. It looks basically like this
struct Coordinate3D {
public bool _check_boundaries;
private int _x;
public int X{
get{ return _x;}
set {
if (_check_boundaries)
{
... check min/max ...
}
_x = value;
}
}
... y and x follow...
}
I want to edit this object in propertyGrid (it is a property of a class). However, some classes have coordinates that are bounded, some not. So, for some classes, boundaries must be checked, but not for others. However, when i change this struct's property in propertyGrid, it seems to create a new struct each time. Therefore, it is either "check boundaries" for all cases or "do not check boundaries" for all cases, depending on what's set in the constructor.
Is there any way around this?