private static void AddMethod(MethodTable methodTable, ICollection <MethodBinding> methodList, Type declaringType, MethodBinding methodBinding, MethodInfo methodInfo) { // Check if we already have a method with the same name and parameters declared. MethodTable.Entry exisitingMethodEntry = methodTable[methodBinding.Name, methodBinding.GetParameterTypes()]; if (exisitingMethodEntry != null) { // Ok we have one. Check if the existing member is not more specific. if (ExistingMemberIsMoreSpecific(declaringType, exisitingMethodEntry.MethodInfo, methodInfo)) { // The existing member is more specific. So we don't add the new one. return; } else { // The new member is more specific. Remove the old one. methodTable.Remove(exisitingMethodEntry); methodList.Remove(exisitingMethodEntry.MethodBinding); } } // Either the new member is more specific or we don't had // a member with same name. methodTable.Add(methodBinding, methodInfo); methodList.Add(methodBinding); }
public void Add(MethodBinding methodBinding, MethodInfo methodInfo) { Entry entry = new Entry(); entry.Key = GenerateKey(methodBinding.Name, methodBinding.GetParameterTypes()); entry.MethodBinding = methodBinding; entry.MethodInfo = methodInfo; _table.Add(entry.Key, entry); }
private static void AddMethod(MethodTable methodTable, ICollection<MethodBinding> methodList, Type declaringType, MethodBinding methodBinding, MethodInfo methodInfo) { // Check if we already have a method with the same name and parameters declared. MethodTable.Entry exisitingMethodEntry = methodTable[methodBinding.Name, methodBinding.GetParameterTypes()]; if (exisitingMethodEntry != null) { // Ok we have one. Check if the existing member is not more specific. if (ExistingMemberIsMoreSpecific(declaringType, exisitingMethodEntry.MethodInfo, methodInfo)) { // The existing member is more specific. So we don't add the new one. return; } else { // The new member is more specific. Remove the old one. methodTable.Remove(exisitingMethodEntry); methodList.Remove(exisitingMethodEntry.MethodBinding); } } // Either the new member is more specific or we don't had // a member with same name. methodTable.Add(methodBinding, methodInfo); methodList.Add(methodBinding); }