We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(13)
我认为最好的办法是学习足够的其他语言,以便您可以手动重写,在某些方面存在一些非常困难的差异,我不确定转换器能否很好地处理。 例如,比较我从 C# 到 VB 的翻译:
变成
C# 来自自定义活动框架示例,恐怕我已经丢失了它的链接。 但它包含一些看起来令人讨厌的继承(从 VB 的角度来看)。
I think the best thing to do is learn enough of the other language so that you can rewrite by hand, there's some quite difficult differences in certain aspects that I'm not sure a converter would handle very well. For example, compare my translation from C# to VB of the following:
becomes
The C# is from the Custom Activity Framework sample, and I'm afraid I've lost the link to it. But it contains some nasty looking inheritance (from a VB point of view).
SharpDevelop 具有 C# 和 VB.NET 之间的内置转换器。 这不是完美的想法(例如,VB.NET 中的可选值在 C# 中没有对应的值,因此必须编辑转换器方法的签名),但您可以节省一些时间,因为您是在 IDE 中进行所有操作而不是网页(复制 C# 代码,粘贴,点击按钮,复制 VB.NET 代码,粘贴到 IDE 上:P)
SharpDevelop has a built-in translator between C# and VB.NET. Is not perfect thought (e.g. the optional values in VB.NET doesn't have an equivalent in C#, so the signature of the converter method must be edited), but you can save some time, as you are making all operations inside an IDE and not a webpage (copy C# code, paste, hit button, copy VB.NET code, paste on IDE :P )
如果您找不到好的转换器,您可以随时编译 C# 代码并使用 Reflector< 中的反汇编器< /a> 查看 Visual Basic 代码。 一些变量名称将会改变。
If you cannot find a good converter, you could always compile the c# code and use the dissasembler in Reflector to see Visual Basic code. Some of the variable names will change.
我目前最常使用这两个:
http://converter.telerik.com/
http://www.carlosag.net/tools/codetranslator/
但在其他方面也取得了一些成功:
http://converter.atomproject.net/
http://www .dotnetspider.com/convert/Csharp-To-Vb.aspx
http://www .developerfusion.com/tools/convert/csharp-to-vb/
I currently use these two most often:
http://converter.telerik.com/
http://www.carlosag.net/tools/codetranslator/
But have also had some success with these others:
http://converter.atomproject.net/
http://www.dotnetspider.com/convert/Csharp-To-Vb.aspx
http://www.developerfusion.com/tools/convert/csharp-to-vb/
Telerik 有一个很好的转换器,它基于 SharpDevelop,多年来一直运行良好,尽管它还没有已更新多年(因为它基于 SharpDevelop)。
我最近遇到了一个 基于 roslyn 的转换器好吧。 我不知道它的工作效果如何或维护得如何,但由于它是开源的,您可以随时分叉它并根据需要更新它。
Telerik has a good converter that is based on SharpDevelop that has worked pretty well over the years, though it has not been updated in years (due to it being based on SharpDevelop).
I've recently come across a roslyn based converter as well. I don't know how well it works or how well maintained it is, but as it's open source you can always fork it and update it as needed.
我正在使用名为 语言转换
它在 2010/2012 上完美运行,不幸的是在 VS 2013 上还不能运行。
转换不是 100% 准确,但它绝对非常有帮助,第一次启动有点棘手,请在下图之前检查:
I am using a free Visual Studio 2012 plug-in named Language Convert
It works perfectly on 2010/2012, unfortunately isn't working at VS 2013 yet.
The conversion is not 100% accurate, but it is definitely very helpful, to launch for the first time it is a bit tricky, check before the image below :
最后我查了一下,SharpDevelop 有一个,而且它也是开源的。
Last I checked, SharpDevelop has one and it is open source too.
您可以将 DLL 或 EXE 加载到 Redgate(以前称为 Lutz Roeder).Net Reflector ,选择您的方法,然后从语言组合中选择所需的语言。 所选方法的代码将以所选语言显示。
我希望这有帮助。
You can load your DLL or EXE into Redgate's (formerly Lutz Roeder's) .Net Reflector, select your method and then the desired language from the language combo. The code of the selected method will be displayed in the selected language.
I hope this helps.
您可以尝试一下这个转换器。 具有 C# 到 VB 和 VB 到 C# 的功能。
希望这可以帮助。
You can try this one converter. There is functionality for C# to VB and VB to C#.
Hope this helps.
Carlos Aguilar Mares 拥有在线转换器已有 40 多年历史 - 代码翻译器 < strong>但我同意 Reflector 是更好的答案。
Carlos Aguilar Mares has had an online converter for about 40 forevers - Code Translator but I would agree that Reflector is the better answer.
虽然不回答你的问题,但我会说我也曾处于类似的境地。
当我真正开始使用 .NET 时,我意识到 C# 中的代码示例很尴尬,但是在我的第一个项目几周后(在我更加熟悉 .NET 框架和 VB.NET 本身之后),我发现它是对 C# 代码进行逆向工程很有趣,有时甚至是有益的。 不仅在语法方面,而且还了解方法上的细微差别 - 在这方面保持开放的态度是有用的。
随着我对 VB.NET 框架的了解越来越多,我会继续使用 VB.NET,但不久之后我就会尝试 C#,以期成为“多语言”者。
While not answering your question, I will say that I have been in a similar position.
I realised that code samples in C# were awkward when I was really starting out in .NET, but a few weeks into my first project (after I grown more familiar with the .NET framework and VB.NET itself), I found that it was interesting and sometimes beneficial to have to reverse-engineer the C# code. Not just in terms of syntax, but also learning about the subtle differences in approach - it's useful to be open-minded in this respect.
I'm sticking with VB.NET as I learn more and more about the framework, but before long I'll dip my to into C# with the intention of becoming 'multi-lingual'.
目前我使用在 CodeProject 上找到的 VS2005 插件 (http://www .codeproject.com/KB/cs/Code_convert_add-in.aspx); 它使用外部服务(http://www.carlosag.net/Tools/CodeTranslator/) 执行翻译。
有时,当我离线时,我会使用转换器工具 (http://www.kamalpatel.net/转换CSharp2VB.aspx)。
Currently I use a plugin for VS2005 that I found on CodeProject (http://www.codeproject.com/KB/cs/Code_convert_add-in.aspx); it use an external service (http://www.carlosag.net/Tools/CodeTranslator/) to perform translation.
Occasionally, when I'm offline, I use a converter tool (http://www.kamalpatel.net/ConvertCSharp2VB.aspx).
位于 http://www.developerfusion.com/tools/convert/ 的那个csharp-to-vb/(新网址)现在支持 .NET 3.5 语法(再次感谢 #develop 人员),并将自动将结果复制到剪贴板:)
The one at http://www.developerfusion.com/tools/convert/csharp-to-vb/ (new url) now supports .NET 3.5 syntax (thanks to the #develop guys once again), and will automatically copy the results to your clipboard :)