Created
November 9, 2016 04:32
-
-
Save netpyoung/53c689a3fed3a0f8aeecf7726603013f to your computer and use it in GitHub Desktop.
roslyn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var comp = SyntaxFactory.CompilationUnit().AddMembers( | |
| SyntaxFactory.NamespaceDeclaration(SyntaxFactory.IdentifierName("ACO")) | |
| .AddMembers( | |
| SyntaxFactory.ClassDeclaration("MainForm") | |
| .AddMembers( | |
| SyntaxFactory.PropertyDeclaration(SyntaxFactory.ParseTypeName("System.Windows.Forms.Timer"), "Ticker") | |
| .AddAccessorListAccessors( | |
| SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration).WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)), | |
| SyntaxFactory.AccessorDeclaration(SyntaxKind.SetAccessorDeclaration).WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken))), | |
| SyntaxFactory.MethodDeclaration(SyntaxFactory.ParseTypeName("void"), "Main") | |
| .AddModifiers(SyntaxFactory.Token(SyntaxKind.PublicKeyword)) | |
| .WithBody(SyntaxFactory.Block(SyntaxFactory.ParseStatement("Console.WriteLine(\"ahello\");"))) | |
| ) | |
| ) | |
| ); | |
| Console.WriteLine(comp.NormalizeWhitespace(" ").ToFullString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment