Beispiel #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);
        }
Beispiel #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);
 }
Beispiel #3
0
 internal static bool IsIEnumerableOfT(this Type type)
 {
     return(type.IsMscorlibType("System.Collections.Generic", "IEnumerable`1"));
 }
Beispiel #4
0
 internal static bool IsIEnumerable(this Type type)
 {
     return(type.IsMscorlibType("System.Collections", "IEnumerable"));
 }
Beispiel #5
0
 internal static bool IsVoid(this Type type)
 {
     return(type.IsMscorlibType("System", "Void") && !type.IsGenericType);
 }
Beispiel #6
0
 internal static bool IsValueType(this Type type)
 {
     return(type.IsMscorlibType("System", "ValueType"));
 }
 internal static bool IsUIntPtr(this Type type)
 => type.IsMscorlibType("System", "UIntPtr");