c# auto convert type code example
Example 1: convert generic to type c#
(SomeClass)Convert.ChangeType(T, typeof(SomeClass));
Example 2: dynamic convert type c#
public static dynamic Convert(dynamic source, Type dest) {
return Convert.ChangeType(source, dest);
}