(I'm working in .NET 4.0 beta, C#.)
I have an interface, and all classes derived from this interface should implement custom ToString()
logic. Is that enforceable? If so, how?
(I'm working in .NET 4.0 beta, C#.)
I have an interface, and all classes derived from this interface should implement custom ToString()
logic. Is that enforceable? If so, how?
Not through an interface.
You'll need to use an abstract class for this.
-- Edit
You can just re-declare 'ToString' as abstract:
abstract class Foo
{
public override abstract string ToString ();
}