简体   繁体   English

如何将vb.net编码转换为工作C#代码?

[英]How to convert vb.net coded to WORKING c# code?

Hi I want to convert the code at Webcam using DirectShow.NET to C#. 嗨,我想使用DirectShow.NETWebcam上的代码转换为C#。 It works perfectly in vb.net. 它在vb.net中完美运行。 I tried converting using an online converter, however I got about 30 errors, 我尝试使用在线转换器进行转换,但是出现了30个错误,

Any suggestions to what I must do next: 关于下一步我必须做的任何建议:

This is the converter that I used : 这是我使用的转换器:

1) Convert VB.NET to C# 1) 将VB.NET转换为C#

The CodeProject article says the author originally converted this sample from C# to VB.NET. CodeProject文章说,作者最初将此示例 C#转换 VB.NET。 This may be the original C# source: 这可能是原始的C#来源:

http://blogs.msdn.com/b/markhsch/archive/2007/11/19/c-webcam-user-control-source.aspx http://blogs.msdn.com/b/markhsch/archive/2007/11/19/c-webcam-user-control-source.aspx

Who says you even have to convert it? 谁说你甚至必须转换它? You could throw it in a Class Library and use the DLL in your C# project. 您可以将其放入类库中,并在C#项目中使用DLL。 No need for translating perfectly working .Net code into other .Net code. 无需将完美运行的.Net代码转换为其他.Net代码。

Without the errors and relavent source code, we can't really help. 没有这些错误和相关的源代码,我们将无能为力。 The best bet is to use an online converter (as you did) and fix compiler errors, then test for other errors. 最好的选择是使用在线转换器(与您一样)并修复编译器错误,然后测试其他错误。

I've used sharpdevelop to translate between vb and c# a few times for projects. 我已经使用SharpDevelop在项目的vb和c#之间进行了几次转换。 It's really pretty great, only had to make minor changes. 这真的很棒,只需要进行一些小的更改。

http://www.sharpdevelop.net http://www.sharpdevelop.net

将RedGate的反射器与已编译的程序集以及Denis Bauer的反汇编器配合使用,以使用您选择的语言获取代码。

I'd echo the npinti's suggestion; 我会回应npinti的建议; but I've never found a converter that will do everything flawlessly. 但我从未找到可以完美完成所有任务的转换器。

My guess is that you'll find several that do a good/great job; 我的猜测是,您会发现其中有几项表现出色/出色。 but you're still going to have to do a little work to get everything to play nice. 但是您仍然需要做一些工作才能使所有游戏都变得不错。

学习C#,然后将其转换。

Here is your golden ticket!!! 这是您的金票!!! ;) When i found this tool (which does a perfect conversion 99% of the time, it really make sa VB developers life easier and opens up all the online snippets and samples exclusively in C now available for a VB'er... Which BTW- is so overlooked on it's strengths at this point, it's just, well, crazy! ;) ;)当我发现此工具(99%的时间可以完成完美转换)时,它确实使sa VB开发人员的工作变得更轻松,并开放了所有专有的C语言在线片段和示例,现在可供VB'er使用。顺便说一句,BTW-在这一点上的优势是如此被忽视,它只是,很好,太疯狂了!

Here is that 'gem' i am referring to: http://converter.telerik.com/ 我指的是“宝石”: http : //converter.telerik.com/

Hope that helps!!! 希望有帮助!!!

也许C-Sharpener For VB可以工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM