I find it useful to override ToString() on many of the simple DTO/POCO classes I write to show some good information when hovering over instances within the debugger.
Here is one example:
public class IdValue< T >
{
public IdValue( int id, T value )
{
Id = id;
Value = value;
}
public int Id { get; private set; }
public T Value { get; private set; }
public override string ToString()
{
return string.Format( "Id: {0} Value: {1}", Id, Value );
}
}
Is there a way in .NET to automatically have a ToString() override that lists out public properties or is there a good convention to follow?