Esempio n. 1
0
        public bool HasConversionFrom(Type ty, NarrowingLevel allowNarrowing)
        {
            if (ty == Type)
            {
                return(true);
            }

            if (ty == None.Type)
            {
                if (_prohibitNull)
                {
                    return(false);
                }

                if (Type.IsGenericType && Type.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    return(true);
                }
                return(!Type.IsValueType);
            }
            else
            {
                return(_binder.CanConvertFrom(ty, Type, allowNarrowing));
            }
        }
Esempio n. 2
0
 public bool HasConversionFrom(Type fromType, NarrowingLevel level)
 {
     return(_binder.CanConvertFrom(fromType, this, level));
 }