none
How to convert VB.NET code to C#?

    Question

  • Hi, I have a small application (in early stages of development) using WinForms.  Is there anyway to convert this code into C#?  I heard C# has better performance than VB.NET.

    Any input/suggestions for this transistion?

    Thank you in advance.

    Friday, October 28, 2011 12:08 PM

Answers

All replies

  • You can convert the vb code to c# using the link below:

    http://www.developerfusion.com/tools/convert/vb-to-csharp/

     


    Amit Govil | Email
    Friday, October 28, 2011 12:10 PM
  • Hi

    You can check this link

    http://www.carlosag.net/Tools/CodeTranslator/

    But, do you have any idea of C# programming??


    Regards TurbulentGeek "
    Mark as answer if it helped you..."
    ;
    Friday, October 28, 2011 12:35 PM
  • If it is only for the performance, you can better use your time to do something more productive. 

    VC# and VB have parity in everything, VB (for Net) has no better performance than VC# and VC# has no better performance than VB (for Net).

    However if you have another reason, than because of that parity are endless converters available.

    For me the best are made by Tangible solutions

    http://tangiblesoftwaresolutions.com/

     


    Success
    Cor

    Friday, October 28, 2011 12:39 PM
  • VC# and VB have parity in everything, VB (for Net) has no better performance than VC# and VC# has no better performance than VB (for Net).
    This may be true if you use options strict, don't use VB error handling, and don't use the built-in VB functions.
    Friday, October 28, 2011 2:37 PM
  • And more more C# to VB converter (and contrary):

    http://converter.telerik.com/


    Mitja
    Friday, October 28, 2011 2:38 PM
  • > How to convert VB.NET code to C#?
     
      
    see http://www.msdn.com/roslyn - let you convert C# to VB and vice versa.
    Friday, October 28, 2011 2:54 PM
  • Load your solution in SharpDevelop and develop in both languages simultaneously.  You'll find very little difference.
    Friday, October 28, 2011 3:19 PM
  • VC# and VB have parity in everything, VB (for Net) has no better performance than VC# and VC# has no better performance than VB (for Net).
    This may be true if you use options strict, don't use VB error handling, and don't use the built-in VB functions.

    Be aware the the parity between option strict of VB off and C# is the dynamic keyword. 

    Also the rest is a little bit tendentious and in fact not really true like it is stated. Some VB functions are optimized and runs faster. However, not important, they both generate the same ILS and the framework runtimes have not a switch which says: "Hello it comes from C# so now I'm performing better".

    I think we should not start a discussion which is better, it makes absolute no sense. This is the C# forum and I like to threat it like that.

    My only meaning of the reply is that he should not expect huge performance benefits because of C#. Maybe he is more an algebraic biased person, then he probably will quicker program in C#, but those things are just personal.

     

     


    Success
    Cor
    Friday, October 28, 2011 5:34 PM
  • There are many tool as suggested by many here. http://codeconvert.codeplex.com/  A open source Vb.net to C# or C# to VB.net from my side.

    No matter which language you select based on your personal preference and past experience, both languages are powerful developer tools and first-class programming languages that share the common language runtime in the .NET Framework so not sure how C# is fater than VB.net.

    As i know The VB.NET parts of Visual Studio .NET compiles your code in the background. While this is considered as an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.

    Anyway, if you've been doing VB.NET for last couple of years the transition shouldn't be as hard as you make it out since the language are very similar. You just have to look at the online VB.NET to C# code translators that are available for evidence. Well several years ago when I was porting over VB.NET to C# code the main things it would choke on was arrays since syntax is different enough and case sensitivity since VB isn't case sensitive. Nowadays, there might be more problems though will all the additions they keep adding to C#. For syntax difference below few links may help you,

    http://www.codeproject.com/KB/dotnet/vbnet_c__difference.aspx

    http://support.microsoft.com/kb/308470

     


    Lingaraj Mishra
    Friday, October 28, 2011 6:40 PM
  • Also the rest is a little bit tendentious and in fact not really true like it is stated. Some VB functions are optimized and runs faster. However, not important, they both generate the same ILS and the framework runtimes have not a switch which says: "Hello it comes from C# so now I'm performing better".


    I didn't say that the VB functions were slower. I didn't measure it to be able to say "this is slower/this is faster". I have a feeling about it, but I didn't wrote it in my reply.

    Calling the VB built-in functions will not generate the same IL as calling non-VB-specific methods.

    Monday, October 31, 2011 8:51 AM
  • Be aware the the parity between option strict of VB off and C# is the dynamic keyword.

    Option Strict Off does more than enabling the use of Object as a dynamic type. But it's true that both have a performance impact.
    Monday, October 31, 2011 8:53 AM
  • Also the rest is a little bit tendentious and in fact not really true like it is stated. Some VB functions are optimized and runs faster. However, not important, they both generate the same ILS and the framework runtimes have not a switch which says: "Hello it comes from C# so now I'm performing better".


    I didn't say that the VB functions were slower. I didn't measure it to be able to say "this is slower/this is faster". I have a feeling about it, but I didn't wrote it in my reply.

    Calling the VB built-in functions will not generate the same IL as calling non-VB-specific methods.

    I thought there was a full stop in my sentence. However if the Microsoft.VisualBasic namespace is used in C# we see back again the same IL. There is nothing strange on that namespace as it is simply a .Net namespace which exist in all existent Framework versions including the next and normally all behind that. Be aware it is primarily used for VB and I do not tell here like others to use it in C#. I myself will never use that namespace in a C# program, but there goes in fact nothing wrong. 

    With that I don't say that a VB program creates always exact the same IL code as C#, seldom 2 different programs create the same IL code. I know that the footprint of a VB program is in some cases strange enough a little bit smaller then a C# one. But it is to little to take attention too. 

     


    Success
    Cor
    Monday, October 31, 2011 1:00 PM
  • Hi brownchap,

    How's it going? Do you have any updates about this issue?


    Bob Shen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, November 03, 2011 4:41 AM