public void _1RemoveAllUnecessarySemicolons() { //A syntax tree with an unnecessary semicolon on its own line var tree = CSharpSyntaxTree.ParseText(@" public class Sample { public void Foo() { //DebugLogger.Instance.WriteLine(); ; } }"); var rewriter = new EmtpyStatementRemoval(); // change source code to other look - without empty statements var result = rewriter.Visit(tree.GetRoot()); //DebugLogger.Instance.WriteLine(result.ToFullString()); }
public void _3Better1Method() { var tree = CSharpSyntaxTree.ParseText(@" public class Sample { public void Foo() { //DebugLogger.Instance.WriteLine(); ; #region SomeRegion //Some other code #endregion ; } }"); var rewriter = new EmtpyStatementRemoval(); var result = rewriter.Visit(tree.GetRoot()); //DebugLogger.Instance.WriteLine(result.ToFullString()); }