CanBeReachedByDownCastOrPromotion() 공개 메소드

public CanBeReachedByDownCastOrPromotion ( IType expectedType, IType actualType ) : bool
expectedType IType
actualType IType
리턴 bool
예제 #1
0
        private int CalculateArgumentScore(IParameter param, IType parameterType, Node arg)
        {
            IType argumentType = GetExpressionTypeOrEntityType(arg);

            if (IsValidByRefArg(param, parameterType, argumentType, arg))
            {
                // boo does not like byref
                return(3);
            }
            else if (parameterType == argumentType)
            {
                // exact match
                return(6);
            }
            else if (parameterType.IsAssignableFrom(argumentType))
            {
                // upcast
                return(5);
            }
            else if (TypeSystemServices.CanBeReachedByDownCastOrPromotion(parameterType, argumentType))
            {
                // downcast
                return(4);
            }
            return(-1);
        }