The string it returns: "Test_Harness.CrewPlanInterface.CrewLeaveWeeks" is the result of the default ToString implementation, inherited from
object
. When you create a class, if you do not create a specific implementation of ToString then anything which tries to convert an instance of your class to a string will return the name of the class (as in this case) instead of any content.
So what you need to do is something like this:
public class MyClass
{
public int X { get; set; }
public int Y { get; set; }
public override string ToString()
{
return string.Format("({0},{1})", X, Y);
}
}
Now, when Tostring is called, it returns a string representation of the location coordinates. Since Convert.ToString calls ToString, it will also do the same thing.
It's a good idea to always create a ToString override for your own classes: if nothing else it's really handy for debugging! :laugh: