FromType() public method

public FromType ( Type type ) : TypeSpec
type System.Type
return TypeSpec
示例#1
0
 protected internal override IEnumerable <TypeSpec> OnLoadGenericArguments()
 {
     if (Type == null)
     {
         return(Enumerable.Empty <TypeSpec>());
     }
     return(Type.GetGenericArguments().Select(x => TypeResolver.FromType(x)));
 }
示例#2
0
        protected internal virtual TypeSpec OnLoadPropertyType()
        {
            if (PropertyInfo == null)
            {
                throw new InvalidOperationException("Unable to load PropertyType when PropertyInfo is null.");
            }

            return(TypeResolver.FromType(PropertyInfo.PropertyType));
        }
示例#3
0
        public virtual TypeSpec OnLoadBaseType()
        {
            if (Type == null)
            {
                throw new InvalidOperationException("Don't know where to get base from when Type is null.");
            }

            return(Type.BaseType != null?TypeResolver.FromType(Type.BaseType) : null);
        }
示例#4
0
        protected internal virtual TypeSpec OnLoadDeclaringType()
        {
            if (PropertyInfo == null)
            {
                throw new InvalidOperationException("Unable to load DeclaringType when PropertyInfo is null.");
            }

            var decType = PropertyInfo.DeclaringType;

            return(decType != null?TypeResolver.FromType(decType) : null);
        }