简体   繁体   中英

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

Hi I want to convert the code at Webcam using DirectShow.NET to C#. It works perfectly in vb.net. I tried converting using an online converter, however I got about 30 errors,

Any suggestions to what I must do next:

This is the converter that I used :

1) Convert VB.NET to C#

The CodeProject article says the author originally converted this sample from C# to VB.NET. This may be the original C# source:

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. No need for translating perfectly working .Net code into other .Net code.

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. It's really pretty great, only had to make minor changes.

http://www.sharpdevelop.net

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

I'd echo the npinti's suggestion; 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! ;)

Here is that 'gem' i am referring to: http://converter.telerik.com/

Hope that helps!!!

也许C-Sharpener For VB可以工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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