Ejemplo n.º 1
0
        internal static bool IsObject(this Type type)
        {
            bool result = type.IsClass && (type.BaseType == null) && !type.IsPointer;

            Debug.Assert(result == type.IsMscorlibType("System", "Object"));
            return(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns type argument if the type is
 /// Nullable&lt;T&gt;, otherwise null.
 /// </summary>
 internal static Type GetNullableTypeArgument(this Type type)
 {
     if (type.IsMscorlibType("System", "Nullable`1"))
     {
         var typeArgs = type.GetGenericArguments();
         if (typeArgs.Length == 1)
         {
             return(typeArgs[0]);
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
 internal static bool IsIEnumerableOfT(this Type type)
 {
     return(type.IsMscorlibType("System.Collections.Generic", "IEnumerable`1"));
 }
Ejemplo n.º 4
0
 internal static bool IsIEnumerable(this Type type)
 {
     return(type.IsMscorlibType("System.Collections", "IEnumerable"));
 }
Ejemplo n.º 5
0
 internal static bool IsVoid(this Type type)
 {
     return(type.IsMscorlibType("System", "Void") && !type.IsGenericType);
 }
Ejemplo n.º 6
0
 internal static bool IsValueType(this Type type)
 {
     return(type.IsMscorlibType("System", "ValueType"));
 }
Ejemplo n.º 7
0
 internal static bool IsUIntPtr(this Type type)
 => type.IsMscorlibType("System", "UIntPtr");