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. The Lounge
  3. difference between C# and VB.Net except syntax Dinesh Says Thanx ....

difference between C# and VB.Net except syntax Dinesh Says Thanx ....

Scheduled Pinned Locked Moved The Lounge
csharpbusiness
68 Posts 36 Posters 1 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.
  • D DineshSharma

    can anybody confirm me theat whats the basic difference between c# and VB.Net. why should I use the C# for my business application development and why vb.net Dear all ...Thanks a lot for your suggestion and a lot of responces.......Thanx:laugh: Dinesh Sharma -- modified at 8:01 Tuesday 16th May, 2006

    H Offline
    H Offline
    Hemanth M
    wrote on last edited by
    #51

    C# is a clean language.Its completely object oriented...where as VB.NET supports procedures along with classes.If your project is very big...u will feel the difference while maintaining the project. Hemanth

    1 Reply Last reply
    0
    • S Super Lloyd

      if you remove the syntax issue much is left out.... Anyway, here on CP are a few articles doing comparison: http://www.codeproject.com/dotnet/vbnet_c__difference.asp[^] http://www.codeproject.com/useritems/vbdefamation.asp[^] And I want to add VB is much more verbose, same code is about 10% bigger, because of longer keywordand syntax. This 10% more opportunity for bug! Althoug VS.NET autocompletion is good at getting rid of them...

      K Offline
      K Offline
      Kenneth Kasajian
      wrote on last edited by
      #52

      It's true that more code can mean more bugs, but code bloat because keywords in one language are longer than in another is not going to contribute to "more code".

      1 Reply Last reply
      0
      • S She chewy

        :confused:If VB6 is so good, why microsoft still throw in the money to invest on C#? Chewy

        H Offline
        H Offline
        Habeeb Rushdan
        wrote on last edited by
        #53

        Good question. I was wondering the same thing too when I first heard that Microsoft had hired the former Borland Delphi guy Anders Hejlsberg to be become their lead C# architect several years ago. However, I quickly realized a good reason why those clever guys at Microsoft did it. You see, C# is very, very, and I mean very close to the syntax of Java. Therefore it is easy for Java developers to pickup C#. I have personally worked with several developers that have made the switch from Java to C# and they were pleasantly surprised at the ease of transition. To see the syntax differences for yourself I suggest you check out this excellent comparison website I found while searching on google. http://www.harding.edu/USER/fmccown/WWW/java1_5_csharp_comparison.html[^] Thanks, Habeeb Live long and code proper!

        1 Reply Last reply
        0
        • G GEAK

          Responses to a couple issues: I used to teach OOP using C++ in college and although I came up with examples using multiple inheritance I never encountered a real-world situation where it was necessary. IMHO, I don't think multiple inheritance is all it's cracked up to be. As to the difference between C# and VB.Net, I've programmed in both (moreso in VB.Net) and found very few differences between them. As well, the more current the version of the .Net framework you use (ignoring syntax), the fewer differences exist. Having said that, there is one major difference I have found: Among the developer community - at least in the region I'm living in - there appears to be a tremendous bias against developing in VB.Net. I suspect this is a throwback to the earlier versions of VB. I've found that 95% of the programs I wrote in C++ could easily be written in either C# or VB.Net and my personal preference would be VB.Net. But when I list VB.Net as my second language on a resume I'm usually declined interviews - the employers appear to be avoiding VB coders. GEAK

          K Offline
          K Offline
          Kenneth Kasajian
          wrote on last edited by
          #54

          Good post. I find multiple-inheritence to be quite useful -- it's a clean way to apply the mix-in pattern. In ATL, for instance, it's kind of slick the way you can add different functionality to your class by inheriting from an implementation. The problems with multiple implementation inheritence have been discussed in great detail by others, and they are real. However, it is also not the case that it is completely useless. In program in both C# and VB.NET. I use C# for professional development, for products, and custom solutions. I use VB.NET of in-house IT related coding. It's easy to hand over VB.NET code to an IT guy who's not really a programmer, but knows a bit of scripting, then giving him C# code. It's easier because of perception, but not reality -- but you know what they say about perception. A feature that I find invaluable in VB.NET is how you can use late-binding, similar to old VB, and VBScript. This makes script like much cleaner looking. C# lacks automatic language-level late-binding the way VB does so when you write code, it looks a lot more bulky. The downside with late binding is that you don't find out you got a problem until it's too late. I would never use it for production code -- but for IT scripting style coding, it's much better. Another thing I like about VB.NET are the new "My" variables. It's just a lot easier than using the .NET framework classes for common operations. I am so utterly indifferent about syntax, that I just can't bring myself to have an actual opinion as to which style is better -- it's just doesn't matter to me -- I'll let others debate whether BEGIN / END is better or worse thatn {, }. It would be a futile discussion with no tangible outcome. Give me a completely different language such as full ANSI Common Lisp under .NET, then we're talking about a different programming paragidm that could be interesting. But C# and VB.NET pretty much are the same thing.

          D 1 Reply Last reply
          0
          • C Christian Graus

            There is a degree to which you're asking about the difference between Roman Catholic and Orthodox here - a degree to which the two sides will say 'the other will burn in HELL'. The truth is, they generate the same IL, so in the hands of a good programmer, there's no difference. However, VB contains a lot of stuff that Microsoft wanted to kill, and the VB community would not let them, C# is by far a better designed language, IMO. I also personally hate VB syntax, it gives me a gut ache. Some people feel the same about C#, I'm told. So, if you have a choice between a skilled VB team and a skilled C# team, and you don't care about the stigma of VB, toss a coin. Otherwise, if you're going to learn a language, I'd say toss a coin again. If you have a choice between a C# team and a team who went to VB.NET from VB6, I'd take the C# team, every time. Christian Graus - Microsoft MVP - C++

            K Offline
            K Offline
            Kenneth Kasajian
            wrote on last edited by
            #55

            I never really bought the argument that because both languages compile into IL, then it doesn't matter how the code is generating. That's like saying that both Cobol and C and compilers compile down to assembly language, so it doesn't matter. If that were the case, JScript.NET code, which compiles down to IL, would execute at the same speed as C# code, but we all know JScript.NET generated code is slower by a magnititude.

            C 1 Reply Last reply
            0
            • P Phil J Pearson

              C# is a language; VB is a pidgin! :-D

              K Offline
              K Offline
              Kenneth Kasajian
              wrote on last edited by
              #56

              The elitist argument for C# over VB.NET is unsustainable. A new generation will realize it doesn't matter, but then again, by then VB.NET might be dead. :)

              1 Reply Last reply
              0
              • K Kenneth Kasajian

                I never really bought the argument that because both languages compile into IL, then it doesn't matter how the code is generating. That's like saying that both Cobol and C and compilers compile down to assembly language, so it doesn't matter. If that were the case, JScript.NET code, which compiles down to IL, would execute at the same speed as C# code, but we all know JScript.NET generated code is slower by a magnititude.

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #57

                Sure, I'm not saying it doesn't matter, I'm saying it doesn't matter in the case of those two languages, the two flagship languages of the framework. That is, they are not different in ways that cause huge differences in performance. Christian Graus - Microsoft MVP - C++

                1 Reply Last reply
                0
                • S She chewy

                  :confused:If VB6 is so good, why microsoft still throw in the money to invest on C#? Chewy

                  R Offline
                  R Offline
                  robvon
                  wrote on last edited by
                  #58

                  C# was born to fight off Java, there was never a technical reason to invent a new language. It does give the curly brace lovers something to hold onto though and something for us to argue about ad nauseum in forums. Such fun.

                  1 Reply Last reply
                  0
                  • C Christian Graus

                    Fair enough, I apologise for the assumption, but it's claimed often enough, and beyond that, I didn't see any reason to point out that the IL isn't exactly identical. All I meant was, the compile to the same intermediate language, not that the IL would look exactly the same. Although, I would contend they will run basically the same, for the same code. Christian Graus - Microsoft MVP - C++

                    C Offline
                    C Offline
                    cheetuan
                    wrote on last edited by
                    #59

                    I am not sure about .NET 2.0, but in .Net 1.x, I actually read an article which illustrate C# compiler actually generate more effencient IL than VB.Net. C# out perform VB.Net in speed and memory usage. The article use a reflection sample code came with .NET framework and dissamble the IL generated by from C# and VB.NET compiler for comparision.

                    C 1 Reply Last reply
                    0
                    • N NeverHeardOfMe

                      A difference between the C "family" and the Visual Basic "family" used to be that the former was a better choice if application performace was your goal, and the latter if productivity (ie producing a working programme quickly) was more important. With the introduction of .NET this difference though perhaps still there to some extent is less the case - and one has to wonder if that is a good thing...

                      Marc Clifton wrote:

                      Those who know the answer use C#. Those who have to ask use VB.

                      Code-snobs choose C because they think it makes them look smarter. Smart people choose VB because it's easier. :) cheers P

                      C Offline
                      C Offline
                      cheetuan
                      wrote on last edited by
                      #60

                      :confused:Microsoft is not being very smart because they use C# to developed .NET framework. However smart people like you have to use a product developed by a not very smart people.

                      1 Reply Last reply
                      0
                      • C cheetuan

                        I am not sure about .NET 2.0, but in .Net 1.x, I actually read an article which illustrate C# compiler actually generate more effencient IL than VB.Net. C# out perform VB.Net in speed and memory usage. The article use a reflection sample code came with .NET framework and dissamble the IL generated by from C# and VB.NET compiler for comparision.

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #61

                        I've seen the same articles. It's true that the IL for VB is slightler larger ( I think it's WORD aligned, actually ), but to say that makes it faster in a meaningful, consistent way is actually a fantasy. Christian Graus - Microsoft MVP - C++

                        1 Reply Last reply
                        0
                        • D DineshSharma

                          can anybody confirm me theat whats the basic difference between c# and VB.Net. why should I use the C# for my business application development and why vb.net Dear all ...Thanks a lot for your suggestion and a lot of responces.......Thanx:laugh: Dinesh Sharma -- modified at 8:01 Tuesday 16th May, 2006

                          A Offline
                          A Offline
                          Andrew Eisenberg
                          wrote on last edited by
                          #62

                          Well, this thread looks like the usual "relgious" wars between one language and the other. As many others have said the choice depends on personal preference. But, I didn't see a poster state what is the main reason for some of us use one language over another. It is that our employers/clients made us use it. Even so, I don't mind my company's language of choice, C#, as I come from a Unix/C/Java background and C# was trivial to pick up. An interesting historical point is that BASIC in all its forms was pretty much dead outside of academia until Microsoft Released Visual Basic 1.0. Now, VB.NET is a far cry from VB 1.0 and I don't have the time to list all the reasons why. And while I personally don't care for the syntax of VB in any of its forms, I have to be fair and say that VB.NET is a credible alternative to C# and most of the differences that many have mentioned are not the core of the .NET framework. Outside of IT, most people wouldn't care if everything was still writen in COBOL as long as their paycheck is on time and their bank and credit card statements are accurate. So, as long as you can get away with using it, use whatever works better for you. Andrew C. Eisenberg Nashville, TN, USA (Yes Virginia, there are rock and roll stations in Nashville! :laugh:)

                          N 1 Reply Last reply
                          0
                          • D deanme

                            Gonzalo Brusella wrote:

                            Basic, in general (and all his flavors: QB, Turbo, GW, etc.) is not a good and "serious" language.

                            One of my undergraduate professors said the same thing about BASIC in 1985. 20+ years later Visual Basic is still one of the most used languages out there. I've heard the MS rumors about wanting to kill VB. Considering how many VB programmers there are, it is unlikely MS will be able to get rid of it any time soon.

                            G Offline
                            G Offline
                            Gonzalo Brusella
                            wrote on last edited by
                            #63

                            I've used to work on MS Latam Developers Support. All the "sponsored" projects on MS Alliance Partners are on C#... Why? The answer is simple: The development word is tending to use C-like coding (C++/C#/JavaScript/Java/Many others), I love the brackets and to be forced to declare the variables on the conde.. You may say "Hey VB with the Option Stict could do it". But it's only an option to the developer. I like those languages that "enforce" the good coding practices. That's all.

                            1 Reply Last reply
                            0
                            • K Kenneth Kasajian

                              Good post. I find multiple-inheritence to be quite useful -- it's a clean way to apply the mix-in pattern. In ATL, for instance, it's kind of slick the way you can add different functionality to your class by inheriting from an implementation. The problems with multiple implementation inheritence have been discussed in great detail by others, and they are real. However, it is also not the case that it is completely useless. In program in both C# and VB.NET. I use C# for professional development, for products, and custom solutions. I use VB.NET of in-house IT related coding. It's easy to hand over VB.NET code to an IT guy who's not really a programmer, but knows a bit of scripting, then giving him C# code. It's easier because of perception, but not reality -- but you know what they say about perception. A feature that I find invaluable in VB.NET is how you can use late-binding, similar to old VB, and VBScript. This makes script like much cleaner looking. C# lacks automatic language-level late-binding the way VB does so when you write code, it looks a lot more bulky. The downside with late binding is that you don't find out you got a problem until it's too late. I would never use it for production code -- but for IT scripting style coding, it's much better. Another thing I like about VB.NET are the new "My" variables. It's just a lot easier than using the .NET framework classes for common operations. I am so utterly indifferent about syntax, that I just can't bring myself to have an actual opinion as to which style is better -- it's just doesn't matter to me -- I'll let others debate whether BEGIN / END is better or worse thatn {, }. It would be a futile discussion with no tangible outcome. Give me a completely different language such as full ANSI Common Lisp under .NET, then we're talking about a different programming paragidm that could be interesting. But C# and VB.NET pretty much are the same thing.

                              D Offline
                              D Offline
                              db_cooper1950
                              wrote on last edited by
                              #64

                              Yes, in C# and VB you are limited to only single inheritence, so make it count for the class that you are working on. However you can use multiple "Imports" (VB), or "using" (C#), which is where I like to derive a broad base of functionality, and of course throwing in my own routines. Yes, there are limitations in VB, (even .NET), I sure would not want to write, let's say, a major modern first person shooter game. But for business logic, and database programming, VB seems to me to be as good or even better, less overhead, than other languages. This is not to take away from C#, it is a great language that doesn't have a huge learning curve. Well anyway that's my thoughts on the subject. DB_Cooper1950

                              K D 2 Replies Last reply
                              0
                              • D db_cooper1950

                                Yes, in C# and VB you are limited to only single inheritence, so make it count for the class that you are working on. However you can use multiple "Imports" (VB), or "using" (C#), which is where I like to derive a broad base of functionality, and of course throwing in my own routines. Yes, there are limitations in VB, (even .NET), I sure would not want to write, let's say, a major modern first person shooter game. But for business logic, and database programming, VB seems to me to be as good or even better, less overhead, than other languages. This is not to take away from C#, it is a great language that doesn't have a huge learning curve. Well anyway that's my thoughts on the subject. DB_Cooper1950

                                K Offline
                                K Offline
                                Kenneth Kasajian
                                wrote on last edited by
                                #65

                                Very good! Nothing like actually having getting work done, right? Yes, being able to import functionality from other libraries is useful -- and composition of implementation this way is clean and ought to be the primary way of enhancing a class. There is a class of problems that can be solved equally by composition and implementation inheritence, and then there are classes that one or the other more useful. For instance, I have seen people use C++'s "Private Inheritence" as a way simulate composition. Why would you say? Well, it's just an easy way to make someone else's code part of your class. I've also see examples of people using Composition when Inheritence more appropriate. In this case, using Composition consists of a whole of tiny wrapper methods. Darn ugly, which was my main point that in such cases, Implementation Inheritence is useful if that interface is one you wish to expose to clients and basically desire an "is a" relationship.

                                D 1 Reply Last reply
                                0
                                • K Kenneth Kasajian

                                  Very good! Nothing like actually having getting work done, right? Yes, being able to import functionality from other libraries is useful -- and composition of implementation this way is clean and ought to be the primary way of enhancing a class. There is a class of problems that can be solved equally by composition and implementation inheritence, and then there are classes that one or the other more useful. For instance, I have seen people use C++'s "Private Inheritence" as a way simulate composition. Why would you say? Well, it's just an easy way to make someone else's code part of your class. I've also see examples of people using Composition when Inheritence more appropriate. In this case, using Composition consists of a whole of tiny wrapper methods. Darn ugly, which was my main point that in such cases, Implementation Inheritence is useful if that interface is one you wish to expose to clients and basically desire an "is a" relationship.

                                  D Offline
                                  D Offline
                                  db_cooper1950
                                  wrote on last edited by
                                  #66

                                  You have brought up some very good points, theft of others code, clumsy / ugly looking code, etc. Personally, I believe that is really up to the author, if they are thieves, and yes there are some, they will steal AND take credit for the code. And, with a little attention, code can both function correctly and not be an eyesore to try to read and do maintenance later on down the line. The “imports” I was talking about was more about framework assemblies and other classes written by the author. Sure some may one line out of ten that they search for and copy / paste, well they sometimes spend more time searching than it would have taken to just write the code. As I was saying that is mostly up to the personality of the person writing the code! But then none of this has to do with the slight differences in C# and VB! DB_Cooper1950

                                  1 Reply Last reply
                                  0
                                  • D db_cooper1950

                                    Yes, in C# and VB you are limited to only single inheritence, so make it count for the class that you are working on. However you can use multiple "Imports" (VB), or "using" (C#), which is where I like to derive a broad base of functionality, and of course throwing in my own routines. Yes, there are limitations in VB, (even .NET), I sure would not want to write, let's say, a major modern first person shooter game. But for business logic, and database programming, VB seems to me to be as good or even better, less overhead, than other languages. This is not to take away from C#, it is a great language that doesn't have a huge learning curve. Well anyway that's my thoughts on the subject. DB_Cooper1950

                                    D Offline
                                    D Offline
                                    digitalgeek
                                    wrote on last edited by
                                    #67

                                    The difference I would use to compare VB and C# is to use the proper tool for the proper job, but at the end of the day there is not much difference. Most programs in VB can be done with C#... it's all .NET and all the objects and methods are the same... just different syntax; but it's all .NET!

                                    1 Reply Last reply
                                    0
                                    • A Andrew Eisenberg

                                      Well, this thread looks like the usual "relgious" wars between one language and the other. As many others have said the choice depends on personal preference. But, I didn't see a poster state what is the main reason for some of us use one language over another. It is that our employers/clients made us use it. Even so, I don't mind my company's language of choice, C#, as I come from a Unix/C/Java background and C# was trivial to pick up. An interesting historical point is that BASIC in all its forms was pretty much dead outside of academia until Microsoft Released Visual Basic 1.0. Now, VB.NET is a far cry from VB 1.0 and I don't have the time to list all the reasons why. And while I personally don't care for the syntax of VB in any of its forms, I have to be fair and say that VB.NET is a credible alternative to C# and most of the differences that many have mentioned are not the core of the .NET framework. Outside of IT, most people wouldn't care if everything was still writen in COBOL as long as their paycheck is on time and their bank and credit card statements are accurate. So, as long as you can get away with using it, use whatever works better for you. Andrew C. Eisenberg Nashville, TN, USA (Yes Virginia, there are rock and roll stations in Nashville! :laugh:)

                                      N Offline
                                      N Offline
                                      nobel tele gl
                                      wrote on last edited by
                                      #68

                                      That was nicely put :cool: Dan Nobel

                                      "The question is not how far. The question is, do you possess the constitution, the depth of faith, to go as far as is needed?" boondock saints

                                      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