CSharp examples for System.Reflection:Type
Is Simple Type
using System.Reflection; using System.Linq; using System.Collections.Generic; using System;//from w w w.j a va2 s .c om public class Main{ public static bool IsSimpleType(this Type type) { if (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(Nullable<>) || type.GetGenericTypeDefinition() == typeof(List<>) || type.GetGenericTypeDefinition() == typeof(IEnumerable<>))) { type = type.GetGenericArguments()[0]; } return type.IsPrimitive || type.IsEnum || type == typeof(string) || type == typeof(DateTime) || type == typeof(Version) || type == typeof(decimal); } }