int result = (int)Convert.ChangeType(integerObject, integerType);
Of course, this is pretty much a useless exercise in this case, but if your "integerObject" has been defined differently (possibly a string), then this is a valid way to do what I think.
You may be interested in this question: Cast with GetType ()
source
share