Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
            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);
            }
Ejemplo n.º 3
0
		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);
		}
Ejemplo n.º 4
0
			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);
			}