Connect 13 C#

I am trying to get the line string  information from a curve primitive type of line string, I am using the primitive to get the length of the line string and using other methods without any issues.

Can someone tell me what I am doing wrong?

.

Thank you

Donna

if (cPrim.GetType().Equals(CurvePrimitive.CurvePrimitiveType.LineString))
{ 
   System.Collections.Generic.IList<DPoint3d> ptList = new System.Collections.Generic.List<DPoint3d>();
   if (cPrim.TryGetLineString(ptList))
    {
        // quick check to determine if code is working
        double segmentDistance = ptList.ElementAt(0).Distance(ptList.ElementAt(1));
        System.Windows.Forms.MessageBox.Show("ptList retrieved - " + segmentDistance.ToString());
    }
}