diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs
index 78e717b490..4da21873e3 100644
--- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs
+++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs
@@ -642,6 +642,21 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
+ ///
+ /// Gets the node as formatted C# output.
+ ///
+ ///
+ /// Formatting options.
+ ///
+ public string GetText (CSharpFormattingOptions formattingOptions = null)
+ {
+ if (IsNull)
+ return "";
+ var w = new StringWriter ();
+ AcceptVisitor (new CSharpOutputVisitor (w, formattingOptions ?? new CSharpFormattingOptions ()), null);
+ return w.ToString ();
+ }
+
public bool Contains (int line, int column)
{
return Contains (new TextLocation (line, column));