如何将Vb代码转换为C#代码 [英] How Do I Covert Vb Code Into C# Code

查看:97
本文介绍了如何将Vb代码转换为C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim frm As Form
Dim formName As String = "frmNewForm"
frm = DirectCast([Assembly].GetEntryAssembly.CreateInstance(formName), Form)





如何将这个vb代码转换为c#代码请帮忙。



how to convert this vb code to c# code please help.

推荐答案

两个解决方案 -

1.如果是想要从VB转换为C#的小代码或少数文件,那么可以使用许多在线转换器 -

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

http://converter.telerik.com/ [ ^ ]

http://www.carlosag.net/tools/codetranslator/ [ ^ ]



如果你想将整个项目从VB.NET转换为C#,那么你需要一个项目转换器 -

http://www.developerfusion.com/tools/convert/bulk/ [ ^ ]

http:// www。 tangiblesoftwaresolutions.com/ [ ^ ]



希望这有帮助。
Two solutions -
1. If it is small code or few files you want to convert from VB to C# then there are many online converter available -
http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]
http://converter.telerik.com/[^]
http://www.carlosag.net/tools/codetranslator/[^]

If you want to convert entire project from VB.NET to C# then you need a project converter -
http://www.developerfusion.com/tools/convert/bulk/[^]
http://www.tangiblesoftwaresolutions.com/[^]

Hope this helps.


除了解决方案1:你可以使用开源ILSpy转换整个程序集;它将创建一个以选定语言编写的逆向工程项目,具有极高的准确性和生成代码的质量。请查看我过去的答案(他们解释如何使用它):

代码解释,C#到VB.NET [ ^ ],

需要将vb代码转换为c# [ ^ ],

FixedPage to ContentPage将c#代码转换为vb.net [ ^ ],

来自exe的源代码 [ ^ ]。br />


-SA
In addition to Solution 1: you can use open-source ILSpy to convert the whole assembly; it will create a reverse-engineered project written in selected language, with great accuracy and quality of the generated code. Please see my past answers (they explain how to use it):
Code Interpretation, C# to VB.NET[^],
Need to convert vb code to c#[^],
FixedPage to ContentPage convert c# code into vb.net[^],
Source Code from a exe[^].

—SA


请阅读我对你评论的评论。



主要问题不是如何将vb.net转换为c#?,而是如何使用程序集?



看看这里:

如何:使用添加添加或删除引用参考对话框 [ ^ ]

程序集和全局程序集缓存(C#和Visual Basic) [ ^ ]

汇编类 [ ^ ]
Please, read my comment to your comment.

The main problem is not "How to convert vb.net to c#?", but "how to use assemblies?"

Have a look here:
How to: Add or Remove References By Using the Add Reference Dialog Box[^]
Assemblies and the Global Assembly Cache (C# and Visual Basic)[^]
Assembly Class[^]


这篇关于如何将Vb代码转换为C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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