Skip to content

Instantly share code, notes, and snippets.

@JoshVarty
Created January 21, 2015 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshVarty/0c78b1fa6c30c96cf631 to your computer and use it in GitHub Desktop.
Save JoshVarty/0c78b1fa6c30c96cf631 to your computer and use it in GitHub Desktop.
var tree = CSharpSyntaxTree.ParseText(@"
public class MyClass{
#region MyRegion
#endregion
}");
//Descend into all node children
//Descend into all trivia children
var regionNodes = tree.GetRoot().DescendantNodes(descendIntoChildren: null, descendIntoTrivia: true).OfType<RegionDirectiveTriviaSyntax>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment