Converting Van. Net  to C#

zachvaldez
zachvaldez used Ask the Experts™
on
What does it takes to convert vb.net to c#? Is it worth the effort  . What benefits or worse situation expected?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi Zach,

In terms of language flexibility, I think people from VB6 background prefer VB.Net and people who are more comfortable with C/C++ family prefer C#.

Over the period of years, Microsoft has brought VB.Net performance to the level of C# so I do not think that slight performance advantage should not matter (ideally).

Benefits are highly controversial when it comes to VB.net and C#. I would like to discuss the differences.

1. VB.Net has historically been treated as a second class citizen - Most of the advancement happen in C# and then they are ported to VB.Net
2. Many a times, ISVs and their add-ons - examples/sample codes are based on C# and sometimes it is really hard to get them in VB.Net.
https://docs.microsoft.com is a really good attempt at having both VB.Net and C# code samples but I still do see some gaps.
3. If you use InterOps, many codes on PInvoke.net are only available as C# code
4. In general, it is easy to get experts on C#.
5. If you are new to C#, you will have some learning curve and you might feel frustrated as things will move slowly - I jumped from VB6 to C# in 2 to 3 days - I know that pain.
6. Some of the language features which you write in VB.Net will look really really hard in C# (but the same thing applies to C# guys when they look at VB.Net code)

As long as the conversion is concerned, please give this one a try:
https://www.tangiblesoftwaresolutions.com/product_details/vb-to-csharp-converter.html

This one is a major disappointment, if you ask me: http://converter.telerik.com/, I suggest you should just blacklist them for any serious conversion.

And of course, my current favorite: https://dotnetfiddle.net/

Regards,
Chinmay.
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
I am a bit confused by Chinmay's comment. Are you trying to convert from VB6 or VB.Net?

Converting some code from VB.Net to C# can be done using tools like http://converter.telerik.com/ but none are perfect.

Maybe the greatest benefits of C# (over VB.Net) is that almost everything you find in books/magazines/websites/... are C#. It is usually easier to find C# developers (at least in my North America market).

Author

Commented:
If you have a large vb project, what does it need to bring it to the c# world granting that budget is not an issue?

What strategy or plan to do it? Where to start?
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Chief Technology Ninja
Distinguished Expert 2018
Commented:
If I were to do it, I would bring in seasoned C# Architect(assuming you already have a VB.Net architect at your disposal) and ask him/her to study the requirements and provide recommendations. Also, if the project was not developed in last 3 to 5 years I would definitely do couple of sessions with stakeholders in order to figure out if the app needs changes.

Afterwards,
1. Lock requirements - no more changes will be accepted until the migration phase completes.
2. Develop test cases and test which we run against current VB.Net code and record their results and get them vetted by stakeholders
3. Then Architect/s can decide how much code can be converted via automatic conversation tools and which code requires manual effort - sometimes it is good to avoid automatic tools - in cases of web services, database connections and network operations you might want to do it manually.
4. Complete the migration process
5. Run the test cases against new C# code and record their result and get them vetted by stakeholders
6. Get a sign off....
7. Celebrate :)

These steps can be applied to a module or the entire project - overall process will not change.

Regards,
Chinmay.
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
What does it takes to convert vb.net to c#? Is it worth the effort?
Well, what problem are you hoping to solve by converting? That may have an impact on your decision to migrate.
AndyAinscowFreelance programmer / Consultant

Commented:
I hope you realise just how .net works.  Someone codes in a .net language, that is then precompiled to an intermediate code, the intermediate code is then converted on the end user machine.
That means that code in vb.net converted to c# will precompile to identical intermediate code.  Which means zero difference in performance.

The difference for you is how good you (or your colleagues) are in vb.net and c# in terms of maintaining and writing new code.

Also bear in mind you can compile vb.net code into a dll which will run seamlessly with other code written in c# which uses that dll and the code it contains.
DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical Speaker

Commented:
How other write why you want convert a VB.NET project in C#?
What is the reason why you do not want to keep it in VB.NET?

Author

Commented:
Great

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial