I am trying to write a generic convert function but I don’t know how do I do that. This is my skeleton:
public static T ConvertByGenerics<T>(string value)
{
//what do I write here?
return default(T);
}
Can anybody help me out? What do I write within the function to dynamically convert string into type T?
Try something like: