Пример #1
0
        protected MethodDeclarationSyntax FindMethod(TypeSyntax type)
        {
            type = type.GetThisAndParents()
                   .TakeWhile(t => t is TypeSyntax)
                   .Cast <TypeSyntax>()
                   .LastOrDefault();

            return(type.Parent.As <MethodDeclarationSyntax>()
                   ?? type.FindUp <ParameterSyntax>()?.Parent?.Parent.As <MethodDeclarationSyntax>());
        }