The Code Converter
Go directly to the converter (supports C#, VB.NET and Boo)
The Code Formatter
Go directly to the Code Formatter (supports ASP/XHTML, BAT, Boo, Coco, C++.NET, C#,
HTML, Java, JavaScript, Patch, PHP, TeX, VBNET, XML)
The code formatting capability is also exposed as a Web service. A sample client application is available
for download. Please note: SharpDevelop ships with \Samples\HtmlSyntaxColorizer on which this Web service is built upon.
Code Conversion as a Web Service
If you want to use code conversion in your code, you can call the
Convert Service. It is really simple to use: reference the service, and
you are good to go. Please use the method Convert (the others are deprecated), and the first
parameter has the following options: cs2vbnet, vbnet2cs, cs2boo, vbnet2boo. If conversion
fails, you can look at the ErrorMessage to see what went wrong. Otherwise, ConvertedSource
will contain the source code in the target language. The service is doing the exact
same steps as the online converter.
A sample Windows Forms application demonstrating the usage of the service is available:
Windows Forms Web Service Client (source included)
Technical Background
The converter uses SharpDevelop's
NRefactory to perform the conversion. For the conversion
to work properly, you have to paste a full class or source code file because we
don't do "magic" RegEx's or string replacement - our code converter uses a full
blown parser, and that's why the source code must be valid.
Note that the conversion is not perfect (ie references to external references can
be guessed only), however, if you encounter a problem such as a wrongly converted
statement, please let us know - after all, the reason why we provide this online
converter is to more easily gather feedback. You can get in touch with us via the
Bug Reporting Forum. By providing us with a sample of what's not working
as expected, we can improve the converter
so you get better results the next time - as well as everyone else.