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. C# vs VB

C# vs VB

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpvisual-studioquestiondiscussion
10 Posts 7 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.
  • U Offline
    U Offline
    User 4483848
    wrote on last edited by
    #1

    I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these myVar = "-1" myVar = -1 This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?

    M L L S 5 Replies Last reply
    0
    • U User 4483848

      I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these myVar = "-1" myVar = -1 This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Member 4487083 wrote:

      do you think it's reasonable for me to dislike VB?

      If not, then apparently I'm unreasonable too :) I don't like it at all, but I haven't tried it, and I come from many many years of C/C++ so C# is natural to me.

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      1 Reply Last reply
      0
      • U User 4483848

        I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these myVar = "-1" myVar = -1 This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?

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

        Member 4487083 wrote:

        do you think it's reasonable for me to dislike VB?

        yeah, it is very reasonable. Don't hesitate, go for the real language. BTW: there are some options that are off by default, if you insist on using VB.NET, turn them on (e.g. Option Strict[^]). :)

        Luc Pattyn


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        N 1 Reply Last reply
        0
        • L Luc Pattyn

          Member 4487083 wrote:

          do you think it's reasonable for me to dislike VB?

          yeah, it is very reasonable. Don't hesitate, go for the real language. BTW: there are some options that are off by default, if you insist on using VB.NET, turn them on (e.g. Option Strict[^]). :)

          Luc Pattyn


          I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          The main option to turn off is when installing Visual Studio. Uncheck the VB.NET box ;P


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • U User 4483848

            I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these myVar = "-1" myVar = -1 This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Each language has its own lovers and haters, so does VB. I had been programming in VB for more than 6 years when I changed to C#. But history tells us that VB is the language that has the shortest learning curve. And there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.

            S 1 Reply Last reply
            0
            • U User 4483848

              I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these myVar = "-1" myVar = -1 This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?

              S Offline
              S Offline
              Simon P Stevens
              wrote on last edited by
              #6

              Member 4487083 wrote:

              weak typing

              VB.net is not weak typed. It is strongly typed just like C#. However, the vb.net compiler does not enforce strict type conversions at compile time in the way the C# compiler does. This means that you are able to directly place an Int in a String object and VB will automatically apply the type conversion. It's still strongly typed, the type is still a String, and the int being placed into it will be cast to a String, it's just casts can happen implicitly. You can use the Option Strict[^] setting to change this behaviour and make the compiler act more like the C# one. Either way, the coder is still free to ignore type usage (equally as they could in C# by declaring everything to be an Object). In terms of the language, both are equally capable and equally well supported. The language choice is almost entirely down to personal preference. There is no really significant technical difference between the two. All that said, I personally prefer C# too.

              Simon

              K 1 Reply Last reply
              0
              • L Lost User

                Each language has its own lovers and haters, so does VB. I had been programming in VB for more than 6 years when I changed to C#. But history tells us that VB is the language that has the shortest learning curve. And there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.

                S Offline
                S Offline
                Simon P Stevens
                wrote on last edited by
                #7

                Shameel wrote:

                there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.

                I don't see what isn't neat about this: http://www.ai.uga.edu/mc/SingleInstance.html[^]. Just because C# doesn't provide tick box for it doesn't mean you can't do it. The choice in language is entirely down to personal preference, there is no significant technical difference.

                Simon

                L 1 Reply Last reply
                0
                • S Simon P Stevens

                  Member 4487083 wrote:

                  weak typing

                  VB.net is not weak typed. It is strongly typed just like C#. However, the vb.net compiler does not enforce strict type conversions at compile time in the way the C# compiler does. This means that you are able to directly place an Int in a String object and VB will automatically apply the type conversion. It's still strongly typed, the type is still a String, and the int being placed into it will be cast to a String, it's just casts can happen implicitly. You can use the Option Strict[^] setting to change this behaviour and make the compiler act more like the C# one. Either way, the coder is still free to ignore type usage (equally as they could in C# by declaring everything to be an Object). In terms of the language, both are equally capable and equally well supported. The language choice is almost entirely down to personal preference. There is no really significant technical difference between the two. All that said, I personally prefer C# too.

                  Simon

                  K Offline
                  K Offline
                  Kevin McFarlane
                  wrote on last edited by
                  #8

                  Simon Stevens wrote:

                  There is no really significant technical difference between the two.

                  IDE editor support is better in C# IMO but that's a usability rather than a technical difference. The Option Strict off by default was a really lousy decision. I've been bitten by this numerous times when working on VB projects.

                  Kevin

                  1 Reply Last reply
                  0
                  • S Simon P Stevens

                    Shameel wrote:

                    there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.

                    I don't see what isn't neat about this: http://www.ai.uga.edu/mc/SingleInstance.html[^]. Just because C# doesn't provide tick box for it doesn't mean you can't do it. The choice in language is entirely down to personal preference, there is no significant technical difference.

                    Simon

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    I you had ever tried one of those solutions, you would realize that all those articles on the internet that teach how to create a single instance desktop application in C# just try to find out if the app is already running and then display a message box that reads "App is already running". I am yet to read any article that teaches how to "neatly" activate the already running instance (without using Microsoft.VisualBasic namespace and AppActivate method). I tried using Win API and P/Invoke but no luck :-(

                    1 Reply Last reply
                    0
                    • U User 4483848

                      I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these myVar = "-1" myVar = -1 This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      Member 4487083 wrote:

                      I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?

                      Other people don't like VB.NET, C# or C++, and opt for Python, Ruby or even Pascal[^]. So you're not so sharp on VB. The *cool* news here is that you can team up with a VB.NET programmer, even if he/she isn't too keen on C# - you can both write your .NET classes in your own language :)

                      I are Troll :suss:

                      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