Using Reflection with Generic Types : Generic Type « Reflection « C# / CSharp Tutorial






using System;
using System.Collections.Generic;

public class Program
{
  public static void Main()
  {

      Stack<int> s = new Stack<int>();

      Type t = s.GetType();

      foreach(Type types in t.GetGenericArguments())
      {
          System.Console.WriteLine(
              "Type parameter: " + types.FullName);
      }
      // ...
  }
}








19.10.Generic Type
19.10.1.Type: MakeGenericType
19.10.2.Reflection with Generics
19.10.3.Using Reflection with Generic Types