I want to use GetType() method to get the Type of the variable then cast some other variable to this type. For example, I have an Int32 i, a Double d, I want to get Type of d (in general case) then cast i to d's Type then grant i's value to d.
Int32 i = 123;
Double d = 0.0;
Type t = d.GetType();
d = Conversion.CastExamp1 < t > (i);
d = Conversion.ConvertExamp1 < t > (i);
PS: @Zyphrax: i have used your post here Casting a variable using a Type variable but when compiling, it says that "The type or namespace name 't' could not be found...". So could you please describe more detail how to use your code?