As NET programmers are often accustomed to using a language (according to my observation, programmers after 2006 are accustomed to using C #, while those before prefer VB). But for another language, although it can be understood, it is always difficult to write. It is always troublesome to upgrade old projects or test other online open source resources. As a result, many interactive tools between VB and C # were born, such as the Csharp ToVB tool of Developer fusion. However, it is an online version, which may be limited by network conditions, slow response or simply inaccessible due to network ban. To sum up, I'm going to write an interactive tool between C # and VB for everyone to use.
Tool Introduction
This tool is mainly used for batch conversion of folders. It can convert the C # and VB files in the SourceDirectory folder and all subfolders according to the original directory structure and save them in the TargetDirectory. The transformation function is basically the same as the tool of developerfusion. ( http://www.developerfusion.com/tools/convert/csharp-to-vb/ )For example, the keywords foreach and # region can be converted correctly. However, there are still some problems. The reference conversion of hanging events and some resources needs to be improved. Send it out first, please use it. Welcome to give more opinions~
Program interface
The interface is as follows:
Third party libraries used
The tool uses the library of the open source project<SharpDevelop>, and references
ICSharpCode.Core.dll
ICSharpCode.NRefactory.dll
ICSharpCode.SharpDevelop.Dom.dll
log4net.dll
Mono.Cecil.dll
usage method
The usage of this library is as follows:
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver; CodeSnippetConverter converter1 = new CodeSnippetConverter(); converter1.CSharpToVB(code, out errors); converter1.VBToCSharp(code, out errors);
Tools and source code
Tools: CS_VBConverter.rar
Source code: SourceCode.rar
This article is from“ Grapevine Control Blog ”Blog, please keep this source http://powertoolsteam.blog.51cto.com/2369428/1256663