Generic function to handle DataType Conversion
- by Tommo1977
I have the following function in C#, that I want to pass a MySQL DataReader value/object.
If the value of the object passed is a DBNull I need to handle it and return a Null value of that data type e.g null int.
Otherwise I want to convert the returned value like Convert.ToInt32(value) or similar.
public static T ConvertFromDB<T>(object…