I want select one Polysurfase and I need the selected Point

Hello all,

I want finde the selected point to know if it´s near start or end.

I have this in Python but I want changed to c#

my Python code =>

def select():
    getterc = GetObject()
        getterc.SetCommandPrompt("Please select Purlin on Start or end")
        if getterc.Get() == GetResult.Object: #we wait for the result here
            objref = getterc.Object(0)
            id = objref.ObjectId
            point = objref.SelectionPoint()
            point = rs.AddPoint(point)
        getterc.Dispose() #this will be called in all cases 
    return id, point

Thanks Robert