Search code examples
c#nullnullableautocadautocad-plugin

How do I check if Point3d is not null?


My approach was...

Autodesk.AutoCAD.Geometry.Point3d point = null;

but I can't seem to set a Point3d to null.

Can anyone tell me why and how I would check whether a Point3d is null?

(By Point3D I mean Autodesk.AutoCAD.Geometry.Point3d)


Solution

  • The Autocad Point3d is a struct. Hence it can't be null, it always has a value.

    At most, you can test it for invalid numbers. Possibly there is a Point3d.Empty static property to test against.

    If you want it to be able to be null, use Point3d? which makes the struct nullable (by wrapping it in Nullable<T>.