Math.net has ToString()
implementations for most data collections. When used in classes these need to be overridden. I know how to do this for one variable, but how to make it generic for all variables of the same type?
My class definition with one variable ToString()
override:
public class Network
{
public Matrix<double> Win { get; set; } // network input matrix
public Matrix<double> Wres { get; set; } // network reservoir matrix
public Matrix<double> Wout { get; set; } // network output matrix
// constructor
public Network(Matrix<double> Winput, Matrix<double> Wreservoir, Matrix<double> Woutput)
{
Win = Winput;
Wres = Wreservoir;
Wout = Woutput;
}
public override string ToString()
{
return Win.ToString();
}
}
This works on Win
with a call like Console.WriteLine(network.Win.ToString());
but how to output the other matrices Wres
, Wout
(with different dimensions)? I have tried to create three overrides but that doesn't work as the compiler complains:
already defines a member called 'ToString' with the same parameter types
and besides, I am sure there must be a more generic and elegant way to do this.