By default, ToString() will display the type’s name. To show your own
values, you must override the method with one of your own. To illustrate this, let’s
continue our Vertex3d class
Assume the class initially looks like this:
Code:
struct Vertex3d
{
private double _x;
private double _y;
private double _z;
public double X
{
get { return _x; }
set { _x = value; }
}
public double Y
{
get { return _y; }
set { _y = value; }
}
public double Z
{
get { return _z; }
set { _z = value; }
}
public Vertex3d(double x, double y, double z)
{
this._x = x;
this._y = y;
this._z = z;
}
}