Generic TryParse
- by Piers Myers
I am trying to create a generic extension that uses 'TryParse' to check if a string is a given type:
public static bool Is<T>(this string input)
{
T notUsed;
return T.TryParse(input, out notUsed);
}
this won't compile as it cannot resolve symbol 'TryParse'
As I understand, 'TryParse' is not part of any interface.
Is this possible to do at all?