I\'m writing a TemplateEngine that will allow me to use my own markup in text based files. I\'m wanting to add controls as plugins as the application matures. Currently i\'v
you could also use generics:
interface IControl
{
string ID{get;set;}
T Value{get;set;}
}
class SomeControl : IControl
{
public string ID{get;set}
public string Value{get;set;}
}
class SomeOtherControl : IControl
{
public string ID{get;set}
public int Value{get;set;}
}
I like this better than the explicit interface idea if it's just one return value that needs to change. However, I think if you had several properties that each would return a different type, you wouldn't want to have IControl. At least, I wouldn't. In that case I would recommend the explicit interfaces.
Of course, this wouldn't work if you didn't have access to the source of IControl.
Edit: had a typo. Fixed