用于将C#.Net代码转换为VB.Net和Vice Versa的C#程序 [英] C# Program for Converting C#.Net code to VB.Net and Vice Versa

查看:79
本文介绍了用于将C#.Net代码转换为VB.Net和Vice Versa的C#程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

任何有关于将c#.net代码转换为VB.Net或反之亦然的想法/链接的机构....
在此先感谢

Hi to all,

Any body having ideas/Link about converting c#.net code to VB.Net and Vice versa....
Thanks in Advance

推荐答案

一个简单的Google搜索将对您有所帮助:

http://www.developerfusion.com/tools/convert/vb-to-csharp/ [^ ]

Visual Studio替代品"SharpDevelop"也内置了此功能.
A simple google search will help already:

http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]

The Visual Studio alternative "SharpDevelop" also has this functionality build in.


似乎您想编写这样一种工具,而不是使用现有的工具.如果是这样,从.NET 4.0开始,您必须找出一种生成等效VB代码的方法.大多数此类应用程序不是直接解析C#代码并生成VB代码,而是将C#代码编译为IL,然后反编译IL生成的VB代码(相对而言,这实际上更容易实现).

使用.NET 5.0,您可能不需要这样做,因为它们具有称为编译器服务的功能,可以向您公开语言对象模型(对于C#和VB,也许对于其他语言也是如此).因此,您可以使用C#程序,获取其对象模型,并使用内置功能用VB节点替换C#节点,然后从转换后的节点重新生成源文件(这将为您提供等效的VB代码).当然,我认为.NET 5.0还需要几年的时间,因此,如果您现在想要这样做,则必须使用前一种方法.

如果您打算将其商业发布,那么我建议您反对.有一些很好的工具,包括免费工具,甚至像Tangible所制造的那样高质量的,市场销售的转换器也卖不完(根据我的经验).
It seems you want to write such a tool rather than use one that exists. If so, as of .NET 4.0 you have to figure out a way to generate equivalent VB code. Rather than directly parse the C# code and generate VB code, what most such applications do is to compile the C# code into IL and then decompile the IL generating VB code (this is actually easier to do, relatively speaking).

With .NET 5.0 you probably won''t need to do this as they have something called compiler services which exposes the language object models to you (for both C# and VB, and perhaps for other languages too). So you can take a C# program, get its object model, and use built-in functionality to replace C# nodes with VB nodes, and then regenerate a source file from the converted nodes (this will give you the VB code equivalent). Of course .NET 5.0 is a couple of years away I''d think, so if you want this now, you''d have to use the former approach.

If you are thinking of releasing this commercially, then I would recommend against it. There are some good tools out there, including free ones, and even a high quality well marketed converter like the one Tangible makes is not selling all that well (based on my experience).


您可以使用以下任何链接将C#转换为vb.net

http://www.developerfusion.com/tools/convert/csharp-to-vb/


将vb.net转换为c#.net
http://www.developerfusion.com/tools/convert/vb-to-csharp/
You can use any of following link for convert C# to vb.net

http://www.dotnetspider.com/convert/Csharp-To-Vb.aspx[^]
OR
http://www.developerfusion.com/tools/convert/csharp-to-vb/


Convert vb.net to c#.net
http://www.developerfusion.com/tools/convert/vb-to-csharp/


这篇关于用于将C#.Net代码转换为VB.Net和Vice Versa的C#程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆