Convert.ChangeType to System.Type
<p>I have a System.Type stored in a variable.  I wish to Change an object's type to this type.</p>

<p>I have the following code, but cannot get the Type to change to the type.</p>

<p>Ideally I'd like: <code>var intTest3 =(MyType)Convert.ChangeType(test, MyType);</code>   to return an int, when : <code>MyType is a System.Int32</code></p>

<p>Here's my working so far - where am I going wrong?</p>

<pre><code>        // object to cast to int
        object test = 1;

        // INT32 type
        Type MyType = typeof(System.Int32);

        // explicit type int WORKS
        var intTest = (int)Convert.ChangeType(test, typeof(Int32));


        // explicit type to int WORKS
        var intTest2 = (int)Convert.ChangeType(test, MyType);

        // explicit type to int WORKS - but as object
        object intTest3 = Convert.ChangeType(test, MyType);


        // cast to my type DOESNT WORK
        var intTest3 =(MyType)Convert.ChangeType(test, MyType);
</code></pre>

<p>Thank you!</p>
