There are various reasons to migrate the code to C#, few of them are listed below:
- C# is an ECMA standards compliant language with a formal definition and a corresponding abundance of third party and open source tools. VB.NET is at Microsoft’s mercy to do whatever they want with it – and they do. VB.NET makes it easy for VB programmer to move to .NET.
- C# code is faster as generated MSIL from C# and VB.NET is not same always
- Terseness and readability of code. C# follows the C, C++, Java syntax tradition, while VB is more verbose.
- IDE Responsiveness – It is difficult to work with a large VB.Net project in Visual Studio
- Improved Code Quality – C# catches many errors allowed in VB.Net, such as variable use before initialization and dead code. It also doesn’t allow undeclared variables, untyped variables, and untyped methods that are allowed in VB.Net.
We will be using an open source tool SharpDevelop developed by IC# (http://www.icsharpcode.net/). This tool is an open source IDE to develop .NET applications similar to Visual Studio and also gives the ability to convert your entire project from VB.NET to C#. We did a POC to convert eService application to C# and its results are very promising. The only compiler issues I found was the implicit type casting issues which C# does not allow. The steps to convert are listed below:
- Download and Install SharpDevelop from the following link http://sourceforge.net/projects/sharpdevelop/files/SharpDevelop%204.x/4.2%20RC/SharpDevelop_4.2.0.8774_RC_Setup.msi/download?_test=xmerch1
- Open your project in SharpDevelop and right click on project and say convert to C#. It will create a new project in C# in your solution directory.
- Open the converted project and compile it.
- Resolve all complier issue, most likely issues will be type casting since c# does not support implicit type casting and tool can not resolve it.
- Once built successfully test the application thoroughly
Note: A web site project first need to be converted to a web application project before you can convert the code to C#. You should also upgrade .NET framework before migrating the code to C#
2 comments:
Good tips for migrate vb.net to c#.
VB.Net Migration
Wow its an amazing blog
Dot Net Online Training
Post a Comment