How to convert Geometrybase into point3d?

I have to convert a Geometry parameter object into point3d,but failed,i check the reason ,may be: Point3d doesnot inherit the “Geometrybase” class
but how to convert a point wraped in geometry parameter component into a point3d?
Thank you!

the problem code in c# script component:
private void RunScript(GeometryBase x, ref object A)
if(x is Point3d)
Point3d pt = (Point3d) x;
A = pt;
} (3.1 KB)

The point here is Rhino.Geometry.Point instead of Rhino.Geometry.Point3d. Your code should be

Point3d pt = Point3d.Unset;
if(x is Rhino.Geometry.Point)
    pt = ((Rhino.Geometry.Point) x).Location;
A = pt;

PS: It’s sad that C# in GH is too old to support type pattern. Otherwise you can just write:

if(x is Rhino.Geometry.Point ptObj)
    A = ptObj.Location;

Thankyou Keyu Gan!it works!
i also find the code works well