Retrieving text dot's "display text" in c#

Dear all,

I am trying to retrieve text dot’s “display text” in C# component. Below is the code that I was working on, and I am having trouble in getting display text from the object. Any help will be much appreciated.

var objArr = Rhino.RhinoDoc.ActiveDoc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.TextDot);
foreach(Rhino.DocObjects.TextDotObject rhObj in objArr)
{
var txt = rhObj.Geometry.UserData; // how to retrieve “display text”?
Print(txt.ToString());
}

Best,
W

Answering my own question… For just in case someone wants to know.

var rhObjArr = Rhino.RhinoDoc.ActiveDoc.Objects.FindByObjectType(Rhino.DocObjects.ObjectType.TextDot);

foreach(Rhino.DocObjects.TextDotObject rhObj in rhObjArr)
{
  var objRef = new Rhino.DocObjects.ObjRef(rhObj);
  var dotObj = objRef.Object() as Rhino.DocObjects.TextDotObject;
  var txtDot = dotObj.Geometry as TextDot;
  var txt = txtDot.Text;
  Print(txt);
}

No need to recreate the reference.

    foreach(Rhino.DocObjects.TextDotObject rhObj in rhObjArr)
    {
      var txtDot = rhObj.Geometry as TextDot;
      var txt = txtDot.Text;
      Print(txt);
    }

Thanks much!