Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Making the switch from VB.net to C#

Making the switch from VB.net to C#

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpswiftquestiondiscussion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    endozs
    wrote on last edited by
    #1

    For the last 7 years I’ve been doing all of my (professional) programming in VB. Now I want to make the long overdue leap to C#. For no real other reason than I have been doing a fair bit of Objective-C in my spare time and I'm sick of syntax hopping for the first couple of blurry hours on Monday morning. I'm not looking to start another C# v VB discussion, and I’m not looking for the noobie VB -> C# conversion charts. What I’m asking is from all you C# gurus what little tricks, tips and advice can you offer a non-noob, who really should have worked in both platforms from day one?

    L T K 3 Replies Last reply
    0
    • E endozs

      For the last 7 years I’ve been doing all of my (professional) programming in VB. Now I want to make the long overdue leap to C#. For no real other reason than I have been doing a fair bit of Objective-C in my spare time and I'm sick of syntax hopping for the first couple of blurry hours on Monday morning. I'm not looking to start another C# v VB discussion, and I’m not looking for the noobie VB -> C# conversion charts. What I’m asking is from all you C# gurus what little tricks, tips and advice can you offer a non-noob, who really should have worked in both platforms from day one?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The language capabilities are basically the same. C# is less verbose and needs more semi-colons and braces; the one thing I appreciate is VB's Handles keyword. New goodies (anonymous delegates, LINQ, lambdas, ...) typically get introduced in C# first, so that should not pose any problems. In practice the main differences I'm aware of are: 1. VB is not very strict by default; you can get away with a few things other languages don't allow. So you might want to add option strict on and the like (if you haven't done so already) and retest, before engaging in a conversion. 2. There are a number of VB-specific namespaces (e.g. Microsoft.VisualBasic.Compatibility), which you could continue to use in another language, although I wouldn't recommend that. 3. Visual Studio does a couple of special tricks to ease the VB->VB.NET transition. Example: all forms are auto-instantiated. 4. Some environmental aspects are different, e.g. Visual Studio offers a splash screen out of the box in VB.NET, not in C#. There probably are a few more issues of this kind, I don't know. In conclusion, if your code started as VB6, was then made to work in VB.NET, then I'd say it deserves some refactoring; and if it is quality VB.NET code, I wouldn't expect real issues. :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      E 1 Reply Last reply
      0
      • L Luc Pattyn

        The language capabilities are basically the same. C# is less verbose and needs more semi-colons and braces; the one thing I appreciate is VB's Handles keyword. New goodies (anonymous delegates, LINQ, lambdas, ...) typically get introduced in C# first, so that should not pose any problems. In practice the main differences I'm aware of are: 1. VB is not very strict by default; you can get away with a few things other languages don't allow. So you might want to add option strict on and the like (if you haven't done so already) and retest, before engaging in a conversion. 2. There are a number of VB-specific namespaces (e.g. Microsoft.VisualBasic.Compatibility), which you could continue to use in another language, although I wouldn't recommend that. 3. Visual Studio does a couple of special tricks to ease the VB->VB.NET transition. Example: all forms are auto-instantiated. 4. Some environmental aspects are different, e.g. Visual Studio offers a splash screen out of the box in VB.NET, not in C#. There probably are a few more issues of this kind, I don't know. In conclusion, if your code started as VB6, was then made to work in VB.NET, then I'd say it deserves some refactoring; and if it is quality VB.NET code, I wouldn't expect real issues. :)

        Luc Pattyn [My Articles] Nil Volentibus Arduum

        E Offline
        E Offline
        endozs
        wrote on last edited by
        #3

        Luc, thankyou very much for taking the time to respond. I think my ignorant self may have been ambiguous, sorry. What I should have asked is Making the switch from VB.net to C#. I sometimes forget there was a vb world before .net Sorry, but thanks again. p.s. i've just edited the title

        L 1 Reply Last reply
        0
        • E endozs

          Luc, thankyou very much for taking the time to respond. I think my ignorant self may have been ambiguous, sorry. What I should have asked is Making the switch from VB.net to C#. I sometimes forget there was a vb world before .net Sorry, but thanks again. p.s. i've just edited the title

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          No problem, I think I covered both cases in one anyway, while assuming you already had VB.NET, given your choice of forum. :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          1 Reply Last reply
          0
          • E endozs

            For the last 7 years I’ve been doing all of my (professional) programming in VB. Now I want to make the long overdue leap to C#. For no real other reason than I have been doing a fair bit of Objective-C in my spare time and I'm sick of syntax hopping for the first couple of blurry hours on Monday morning. I'm not looking to start another C# v VB discussion, and I’m not looking for the noobie VB -> C# conversion charts. What I’m asking is from all you C# gurus what little tricks, tips and advice can you offer a non-noob, who really should have worked in both platforms from day one?

            T Offline
            T Offline
            thatraja
            wrote on last edited by
            #5

            Hope this blog post will be useful to you. .NET Code Conversion[^]

            thatraja


            FREE Code Conversion VB6 ASP VB.NET C# ASP.NET C++ JAVA PHP DELPHI | Nobody remains a virgin, Life screws everyone :sigh:

            1 Reply Last reply
            0
            • E endozs

              For the last 7 years I’ve been doing all of my (professional) programming in VB. Now I want to make the long overdue leap to C#. For no real other reason than I have been doing a fair bit of Objective-C in my spare time and I'm sick of syntax hopping for the first couple of blurry hours on Monday morning. I'm not looking to start another C# v VB discussion, and I’m not looking for the noobie VB -> C# conversion charts. What I’m asking is from all you C# gurus what little tricks, tips and advice can you offer a non-noob, who really should have worked in both platforms from day one?

              K Offline
              K Offline
              Kangerm00se
              wrote on last edited by
              #6

              A few months ago I finally made the same switch, and I don't regret it. The few things that took a bit of time to get used to: - A few type conversions that are handled automatically by VB need to be explicit in C#. It does however force you into better programming. - If you are working with forms: Forms are instances of the Form object (well, as they should be in OOP). The default form you get in VB however is static. - If you're working with Visual Studio: use the latest one (2010); in older versions the intellisense felt a bit slower in C# compared to VB (might be just a 'feeling'). Good luck.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups