using static System.Console; using System.Collections.Generic; using System; public class Program { public static void Main() { WriteLine(typeof(Nullable).Name); WriteLine(typeof(Nullable<>).Name); int? nInt = 0; decimal? nDecimal = 0M; List lInt = new List(); int xInt = 1; string xString = ""; decimal xDecimal = 2M; Dictionary dStingInt = new Dictionary(); PrintObject(nInt); PrintObject(nDecimal); PrintObject>(lInt); PrintObject(xInt); PrintObject(xString); PrintObject(xDecimal); PrintObject>(dStingInt); } private static void PrintObject(T obj) { var type = typeof(T); var generic = type.IsGenericType; var nullable = generic && type.GetGenericTypeDefinition() == typeof(Nullable<>); WriteLine($"{type.Name} - {type.IsGenericType} - {(generic ? type.GetGenericTypeDefinition().Name : (""))} - {(nullable ? Nullable.GetUnderlyingType(type).Name : (""))} - {type.Name}\n"); } } //https://pt.stackoverflow.com/q/185142/101