GetHiddenBaseClassMethod() публичный статический Метод

Returns the method from the closest base class that is hidden by the given method according to C# rules. If the method is an interface method definition, then look at it's base interfaces If no such method exists, Dummy.MethodDefinition is returned.
public static GetHiddenBaseClassMethod ( IMethodDefinition derivedClassMethod ) : IMethodDefinition
derivedClassMethod IMethodDefinition
Результат IMethodDefinition
Пример #1
0
        public virtual void PrintMethodDefinitionModifiers(IMethodDefinition methodDefinition)
        {
            Contract.Requires(methodDefinition != null);

            // This algorithm is probably not exactly right yet.
            // TODO: Compare to FrameworkDesignStudio rules (see CCIModifiers project, and AssemblyDocumentWriter.WriteMemberStart)

            if (IsMethodUnsafe(methodDefinition))
            {
                PrintKeywordUnsafe();
            }

            if (!(Utils.GetHiddenBaseClassMethod(methodDefinition) is Dummy))
            {
                PrintKeywordNew();
            }

            if (methodDefinition.ContainingTypeDefinition.IsInterface)
            {
                // Defining an interface method - 'unsafe' and 'new' are the only valid modifier
                return;
            }

            if (!methodDefinition.IsAbstract && methodDefinition.IsExternal)
            {
                PrintKeywordExtern();
            }

            if (IsDestructor(methodDefinition))
            {
                return;
            }

            if (methodDefinition.IsStatic)
            {
                PrintKeywordStatic();
            }
            else if (methodDefinition.IsVirtual)
            {
                if (methodDefinition.IsNewSlot &&
                    (IteratorHelper.EnumerableIsNotEmpty(MemberHelper.GetImplicitlyImplementedInterfaceMethods(methodDefinition)) ||
                     IteratorHelper.EnumerableIsNotEmpty(MemberHelper.GetExplicitlyOverriddenMethods(methodDefinition))))
                {
                    // Implementing a method defined on an interface: implicitly virtual and sealed
                    if (methodDefinition.IsAbstract)
                    {
                        PrintKeywordAbstract();
                    }
                    else if (!methodDefinition.IsSealed)
                    {
                        PrintKeywordVirtual();
                    }
                }
                else
                {
                    // Instance method on a class
                    if (methodDefinition.IsAbstract)
                    {
                        PrintKeywordAbstract();
                    }

                    if (methodDefinition.IsNewSlot)
                    {
                        // Only overrides (or interface impls) can be sealed in C#.  If this is
                        // a new sealed virtual then just emit as non-virtual which is a similar thing.
                        // We get these in reference assemblies for methods which were implementations of private (and so removed)
                        // interfaces.
                        if (!methodDefinition.IsSealed && !methodDefinition.IsAbstract)
                        {
                            PrintKeywordVirtual();
                        }
                    }
                    else
                    {
                        PrintKeywordOverride();
                        if (methodDefinition.IsSealed)
                        {
                            PrintKeywordSealed();
                        }
                    }
                }
            }
        }