bool IsSignatureMatch(IType indexerElementType, IList <IType> indexerParameterTypes)
        {
            indexerElementType.GetAllBaseTypes();
            if (indexerParameterTypes.Count != argumentTypes.Count)
            {
                return(false);
            }
            var returnConversion = conversions.ImplicitConversion(indexerElementType, returnType);

            if (!returnConversion.IsValid)
            {
                return(false);
            }
            for (int i = 0; i < argumentTypes.Count; i++)
            {
                var conversion = conversions.ImplicitConversion(indexerParameterTypes[i], argumentTypes[i]);
                if (!conversion.IsValid)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
            bool IsValidReferenceOrBoxingConversion(IType fromType, IType toType)
            {
                Conversion c = conversions.ImplicitConversion(fromType, toType);

                return(c.IsValid && (c.IsIdentityConversion || c.IsReferenceConversion || c.IsBoxingConversion));
            }