Created
January 22, 2015 17:01
-
-
Save stdray/3a5c442dab8434a78408 to your computer and use it in GitHub Desktop.
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
| using Nemerle; | |
| using System.CodeDom; | |
| using System.CodeDom.Compiler; | |
| public class Test | |
| { | |
| public static Main() : void | |
| { | |
| def type = CodeTypeDeclaration("Foo"); | |
| type.IsEnum = true; | |
| def field = CodeMemberField("Foo", "Bar"); | |
| _ = field.CustomAttributes.Add(CodeAttributeDeclaration("Baz", array[ ])); | |
| _ = type.Members.Add(field); | |
| def writer = System.IO.StringWriter(); | |
| def provider = Nemerle.Compiler.NemerleCodeProvider(); | |
| provider.GenerateCodeFromType(type, writer, CodeGeneratorOptions()); | |
| System.Console.WriteLine(writer); | |
| _ = System.Console.ReadLine(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment