-
Notifications
You must be signed in to change notification settings - Fork 138
Open
Description
I came in a situation where I checked a Polygon2D if it was null or not and in any case it returned false.
Try this code to reproduce:
Polygon2D polygon = null;
bool isNull = polygon == null;
The variable isNull
should result in being true
, but is not!
Essentially what is missing in the "=="-operator is something like this:
//both null
if (ReferenceEquals(left, null) && ReferenceEquals(right, null))
return true;
//for null-condition
if (ReferenceEquals(left, null) || ReferenceEquals(right, null))
return false;
This seems to be the same situation for nearly all classes of Euclidian namespace!
- CoordinateSystem (null-condition NOT checked)
- PolyLine2D (null-condition is checked)
- PolyLine3D (null-condition is checked)
- Polygon2D (null-condition is checked)
Or am I missing something? As mathnet-spatial mostly uses structs it is not that obvious
Metadata
Metadata
Assignees
Labels
No labels