System.DefaultBinder.ExactPropertyBinding C# (CSharp) Method

ExactPropertyBinding() public static method

public static ExactPropertyBinding ( PropertyInfo match, Type returnType, Type types, ParameterModifier modifiers ) : PropertyInfo
match System.Reflection.PropertyInfo
returnType Type
types Type
modifiers System.Reflection.ParameterModifier
return System.Reflection.PropertyInfo
        public static PropertyInfo ExactPropertyBinding(PropertyInfo[] match,Type returnType,Type[] types,ParameterModifier[] modifiers)
        {
            if (match==null)
                throw new ArgumentNullException("match");

            PropertyInfo bestMatch = null;
            int typesLength = (types != null) ? types.Length : 0;
            for (int i=0;i<match.Length;i++) {
                ParameterInfo[] par = match[i].GetIndexParameters();
                int j;
                for (j=0;j<typesLength;j++) {
                    Type pCls = par[j].ParameterType;
                    
                    // If the classes  exactly match continue
                    if (pCls != types[j])
                        break;
                }
                if (j < typesLength)
                    continue;
                if (returnType != null && returnType != match[i].PropertyType)
                    continue;
                
                if (bestMatch != null)
                    throw new AmbiguousMatchException(Environment.GetResourceString("RFLCT.Ambiguous"));

                bestMatch = match[i];
            }
            return bestMatch;
        }