In my user interface class, the developer has the ability to define the location property (type System.Drawing.Point). By default, this property is initialized by Point.Empty. The internal code encapsulated by the class uses the .IsEmpty of the Point property to determine if a location has been set. If the property is not empty, the value x / y will be used. If empty, the code will try to put it using the row / column algorithm.
My question is:
I use the .IsEmpty property to determine if it has been set. To my surprise, if the developer sets the property to 0.0, it appears as Empty. Point 0,0 is valid in the chart. I also understand why .IsEmpty returns true for a value of 0.0.
1) Without creating your own class or inheriting from System.Drawing.Point, is there a way to find out if a property has been set?
The only idea I can think of is to assign a value with the value "new Point (-1, -1)" by default and test against it. Is there a better way? If not, please confirm.
I am using C # in Visual Studio 2005 and Visual Studio 2008
Thanks!
source
share