Question: I've got this class with a method that returns an object:

```
public class Deserializer<T>
{
    public static T FromJson(string json)
    {
        return new JavaScriptSerializer().Deserialize<T>(json);
    }   
}

```

And I've got a Type. How do I create an instance of the Deserializer class based on a this type? The following obviously doesn't work:

```
var type = typeOf(MyObject);
var foo = Deserializer<type>.FromJson(json);

```

Answer: 
This is how you could do it, but it's not exactly optimal unless you absolutely must do it this way. Go with one of the other answers if you can!

```
dynamic result = typeof(Deserializer<>).MakeGenericType(type)
    .InvokeMember("FromJson", BindingFlags.Public | BindingFlags.Static |
                              BindingFlags.InvokeMethod, null, null,
                  new [] { json });

```
You can't do this. Generic type parameters are statically bound (compile-time). You can't pass it a `System.Type` object.

For your simple example, You could (somewhat obviously) just use `MyObject`:

```
MyObject foo = Deserializer<MyObject>.FromJson(json);

```

If you could do this, what would the resultant type of `FromJson` be? How would you use that object?

```
Type t = ___;  // How do you get this?
??? foo = Deserializer<t>.FromJson(json);   // What datatype is foo?

```

What you're trying to do isn't a feature of a statically-typed language like C#. It's more of a dynamic language feature, like Python, where you just return whatever you want and do whatever you want to it.