And if so, why can't you do this:
public interface IParsable
{
static IParsable Parse(string s);
static bool TryParse(string s, out IParsable);
}
in C#?
EDIT: Or, alternatively:
public interface IParseable<T>
{
static T Parse(string s);
static bool TryParse(string s, out T);
}
EDIT #2: I have learned the folly of my ways by trying to use an IParsable, as suggested by many below. The example I made follows. Of course, there is no way to resolve the call to TryParse...
public IParsable ReadFromKeyboard()
{
IParsable ToReturn;
bool FirstTry = false;
bool Success;
do
{
if (!FirstTry)
DisplayError();
AskForInput();
Success = IParsable.TryParse(Console.ReadLine, out ToReturn);
FirstTry = false;
} while(!Success)
return ToReturn;
}