Ejemplo n.º 1
0
            private static SyntaxNode GetParentNode(ExpressionSyntax expression)
            {
                var topMostExpression = expression
                                        .AncestorsAndSelf()
                                        .OfType <ExpressionSyntax>()
                                        .LastOrDefault();

                return(topMostExpression.Parent);
            }
Ejemplo n.º 2
0
 public static MethodDeclarationSyntax FindMethodDeclaration(this ExpressionSyntax expression)
 {
     return(expression.AncestorsAndSelf()
            .OfType <MethodDeclarationSyntax>()
            .FirstOrDefault());
 }
 private static SyntaxNode GetTopMostParentingExpression(ExpressionSyntax expression)
 {
     return(expression.AncestorsAndSelf().OfType <ExpressionSyntax>().Last());
 }