public CanBeReachedByDownCastOrPromotion ( IType expectedType, IType actualType ) : bool | ||
expectedType | IType | |
actualType | IType | |
Результат | bool |
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); }