I. First compilation and adjustmentCode
2. fixed the problem where generic code could not be generated.
I will use this tool later. If you need to modify it, it will be modified and improved in time. If you are interested, you can participate. Http://codedomassistant.codeplex.com/
Generating codedom code by parsing C # Or VB
Use C # Or VB to generate codedom code
Introduction
I find writing codedom code kind of like writing assembly. it's like cutting the grass with a pair of scissors or unloading a truck load of sand with a spoon. its long winded, it can be done, but it is tedious. however, there are advantages in using codedom.
Now, it wocould be nice if you cocould whip up a class in VB or C # and generate the codedom code. codedom assistant does this with the help of sharpdevelop's nrefactory library in conjunction with writing our own codedomprovider to generate C # codedom code. the code you get will construct a codedom compileunit, and it will definitely be uugly. but what can you expect CT from a machine?
Background
Code generation can be done using various techniques. In essence, code generation saves time, and enables you to create code using established patterns.
In the world. net, one technique is to use codedom. it allows you create a Document Object Model of the Code. this can by either compiled into an assembly or used to generate code. every. net Language shoshould have an implementation of a codedomprovider to generate code. the problem is that codedom does not implement every syntax construct of every language. in essence, it is a subset, but there are enough operations to emulate most language constructs.
Parsing C # Or VB is going to be the toughest part, but luckily one of sharpdevelop's little libraries is nrefactory. this has the machinerary required to parse C # Or VB code. the key component for us is the codedomvisitor class. sadly, it is only a partial implementation. they implement enough to run sharpdevelop's form generation. I am not saying I have completed the implementation, rather, I have filled most of the holes in the codedomvisitor.
The second part is implementing a codedomcodeprovider. This will take a codedom compile unit and generate C # code that will create a codedom compile unit.
License
This article has no explicit license attached to it but may contain in usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
About the old version author
Raygilbert
Http://www.codeproject.com/Articles/20597/CodeDom-Assistant
Http://www.codeplex.com/Download? Projectname = codedomassistant & downloadid = 381289
Http://download.codeplex.com/Download? Projectname = codedomassistant & downloadid = 381290
About New Version author
Mysticboy
Http://www.mysticboy.cn
Original article:
Codedom assistant codedom powerful tool. Some bugs have been fixed and sent to codeplex.
Http://www.xjiter.com/forum.php? MoD = viewthread & tid = 86 & fromuid = 1