IronAHK.Scripting.ILMirror.FindMatchingGenericMethod C# (CSharp) Метод

FindMatchingGenericMethod() приватный Метод

private FindMatchingGenericMethod ( MethodBase Orig ) : MethodBase
Orig MethodBase
Результат MethodBase
        MethodBase FindMatchingGenericMethod(MethodBase Orig)
        {
            Type Generic = Orig.DeclaringType.GetGenericTypeDefinition();
            ParameterInfo[] OrigParams = Orig.GetParameters();
            
            if(Orig.IsConstructor)
            {
                foreach(ConstructorInfo Info in Generic.GetConstructors())
                {
                    if(GenericMethodIsEquivalent(Orig, Info, OrigParams))
                        return Info;
                }
            }
            else
            {
                foreach(MethodInfo Info in Generic.GetMethods())
                {
                    if(GenericMethodIsEquivalent(Orig, Info, OrigParams))
                        return Info;
                }
            }
            
            throw new Exception("Could not find matching method");
        }