CodeDom Assistant CodeDom的强大工具, 有些BUG修正了下,发到CodePlex,大家有需要的可以看看...

CodeDom Assistant CodeDom的强大工具, 有些BUG修正了下,发到CodePlex,大家有需要的可以看看

一、第一次编译并调整代码 二、修正泛型无法生成CodeDOM代码 后期我会用到这个工具, 如果有需要修改, 会及时修改和改进, 有兴趣的可以参与进来。 http://codedomassistant.codeplex.com/
Generating CodeDom Code By Parsing C# or VB 使用C#或者VB生成CodeDom代码

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 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

 

原文:

CodeDom Assistant CodeDom的强大工具, 有些BUG修正了下,发到CodePlex了 http://www.xjiter.com/forum.php?mod=viewthread&tid=86&fromuid=1

转载于:https://my.oschina.net/mysticboy/blog/541347

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值