Example #1
0
        public static TypeInfo GetTypeInfo(this Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            IReflectableType type2 = (IReflectableType)type;

            return((type2 != null) ? type2.GetTypeInfo() : null);
        }
Example #2
0
        public sealed override TypeInfo GetTypeInfo(Type type)
        {
            RuntimeType runtimeType = type as RuntimeType;
            if (runtimeType != null)
                return runtimeType.GetRuntimeTypeInfo();
            IReflectableType reflectableType = type as IReflectableType;
            if (reflectableType != null)
                return reflectableType.GetTypeInfo();

            throw runtimeType.GetReflectionDomain().CreateMissingMetadataException(type);
        }
        public static TypeInfo GetTypeInfo(this Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            IReflectableType reflectableType = (IReflectableType)type;

            if (reflectableType == null)
            {
                return(null);
            }
            return(reflectableType.GetTypeInfo());
        }
Example #4
0
        public static TypeInfo GetTypeInfo(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            IReflectableType reflectableType = type as IReflectableType;

            if (reflectableType != null)
            {
                return(reflectableType.GetTypeInfo());
            }
            return(new TypeDelegator(type));
        }
Example #5
0
        public static TypeInfo GetTypeInfo(this Type type)
        {
            IReflectableType reflectableType = type as IReflectableType;

            if (reflectableType != null)
            {
                return(reflectableType.GetTypeInfo());
            }

            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            // This is bizarre but compatible with the desktop which casts "type" to IReflectableType without checking and
            // thus, throws an InvalidCastException.
            object ignore = (IReflectableType)type;

            Debug.Fail("Did not expect to get here.");
            throw new InvalidOperationException();
        }
Example #6
0
        //public static Type[] GetGenericArguments(this Type type)
        //{
        //    return type.GetTypeInfo().GenericTypeArguments;
        //}

        public static TypeInfo GetTypeInfo(this Type type)
        {
            IReflectableType reflectableType = (IReflectableType)type;

            return(reflectableType.GetTypeInfo());
        }