I like .Net intrinsic data types' Parse and TryParse methods. I would like to define an interface to do similar thing like:
public interface IParsable<T>
{
T Parse<TData>(TData input);
bool TryParse<TData>(TData input, out T output);
}
I tried to search from .Net and I cannot find this interface or similar one available. I try to follow the same practice as in .Net's APIs.
Basically, this interface just provides methods or APIs to convert an input to an output. It could be named as IMapTo. Not sure if there are something already available in .Net or public open source libraries? Any suggestions?