Skip to content

Instantly share code, notes, and snippets.

@JoshVarty
Created January 21, 2015 22:36
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/f7f6f9e67c0b081a3ac4 to your computer and use it in GitHub Desktop.
Save JoshVarty/f7f6f9e67c0b081a3ac4 to your computer and use it in GitHub Desktop.
var tree = CSharpSyntaxTree.ParseText(@"
public class MyClass{
#region MyRegion
#endregion
}");
//Try finding them as nodes.
var regionNodes = tree.GetRoot().DescendantNodes().OfType<RegionDirectiveTriviaSyntax>();
//Try finding them as trivia?
var regionTrivia = tree.GetRoot().DescendantTrivia().OfType<RegionDirectiveTriviaSyntax>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment