Mega Code Archive

 
Categories / C# Tutorial / Reflection
 

Reflection with Generics

using System; using System.Reflection; public class Program {   static void Main()   {       Type type;       type = typeof(System.Nullable<>);       Console.WriteLine(type.ContainsGenericParameters);       Console.WriteLine(type.IsGenericType);       type = typeof(System.Nullable<DateTime>);       Console.WriteLine(!type.ContainsGenericParameters);       Console.WriteLine(type.IsGenericType);   } }