<p>If I have the following code:</p>
<pre><code>MyType&lt;int&gt; anInstance = new MyType&lt;int&gt;();
Type type = anInstance.GetType();
</code></pre>
<p>How can I find out which type argument(s) &quot;anInstance&quot; was instantiated with, by looking at the type variable? Is it possible?</p>

Use
Type.GetGenericArguments
. For example:
```
```
using System;
using System.Collections.Generic;

public class Test
{
    static void Main()
    {
        var dict = new Dictionary<string, int>();

        Type type = dict.GetType();
        Console.WriteLine("Type arguments:");
        foreach (Type arg in type.GetGenericArguments())
        {
            Console.WriteLine("  {0}", arg);
        }
    }
}
```
```
Output:
```
```
Type arguments:
  System.String
  System.Int32
```
```