Click here to Skip to main content
15,894,720 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi to all,

Any body having ideas/Link about converting c#.net code to VB.Net and Vice versa....
Thanks in Advance
Posted
Comments
Keith Barrow 27-Oct-10 8:48am    
There are online tools for doing this, just so you don't have to hand roll your own. Google for "VB to C# convertors"

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.
 
Share this answer
 
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).
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900