CodeDom CodeDom powerful tool Assistant, BUG fixes some down, sent to CodePlex, we have a need to look ...

Powerful tools CodeDom Assistant CodeDom, some BUG revised down, sent to CodePlex, we have a need to look

First, the first compilation and adjust the code Second, the amendment can not be generated CodeDOM generic post-code I will use this tool if there is need to change, will be revised and improved, are interested can get involved. http://codedomassistant.codeplex.com/
Generating CodeDom Code Parsing By using C # C # or VB or VB generated codes CodeDom

Introduction
the I Find CodeDom Writing Writing code kind of like Assembly. It apos like with A Grass Cutting The 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 would be nice if you could 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 ugly. But what can you expect 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 of .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 should 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 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:

Powerful tools CodeDom Assistant CodeDom, some BUG revised down, sent to the CodePlex http://www.xjiter.com/forum.php?mod=viewthread&tid=86&fromuid=1

Reproduced in: https: //my.oschina.net/mysticboy/blog/541347

Guess you like

Origin blog.csdn.net/weixin_34000916/article/details/92064632