From 60b3164b65f29fd0ab86bd8200159ece274538cd Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 9 Mar 2011 10:03:17 +0100 Subject: [PATCH] NRefactory AstNode: add DescendantsAndSelf property. --- ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs index 2dab5a5ad9..dafcdc2533 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs @@ -157,6 +157,15 @@ namespace ICSharpCode.NRefactory.CSharp } } + /// + /// Gets all descendants of this node (including this node itself). + /// + public IEnumerable DescendantsAndSelf { + get { + return Utils.TreeTraversal.PreOrder(this, n => n.Children); + } + } + /// /// Gets the first child with the specified role. /// Returns the role's null object if the child is not found.