Get lenght of a curve

I would like to find out  - without a macro from other programmers :-) the lenght of curve's

In corel i select a simple shape.

Why this not work?

1
2
3
4
5
6
7
8
9
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            corel.Shape selectedShape = corelApp.ActiveSelection;
            if (selectedShape.Type == corel.cdrShapeType.cdrCurveShape)
            {
              double l = selectedShape.Curve.Length;
              TB_LineLenght.Text = l.ToString();
            }
        }