Difference between c#.net and VB.net
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 26

Thread: Difference between c#.net and VB.net

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    Turkey
    Posts
    54

    Difference between c#.net and VB.net

    Hi!
    I'm learning c# and some people say c# and VB.net is same powerful but VB.net is easier so it is better if i use VB.net. But i dont know why, i hate VB. What is the difference between VB.net and c#? The reason of c# to be the the main language of .net is to be like java? What do you think?

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Difference between c#.net and VB.net

    I prefer C# to VB.NET for various reasons :

    (1) Fewer keystrokes. It takes fewer keystrokes to write in C# than write in VB.NET.
    (2) Curly brackets for blocks. I find VB.NET code seems to be all "jumbled" up, especially between while loops, if statements etc.
    (3) 'unsafe' code. In VB.NET you have to do everything through GCHandle. It's far nicer to write "fixed (byte *pbArray = abArray)" in my opinion.
    (4) Events and Delegates handling. It's far superior in C# than in VB.NET in my opinion.
    (5) "using". I use this a lot to make sure that code is always executed on exiting blocks of code. I don't believe VB.NET has anything similar.

    I just find VB.NET 'clunky' to use. For instance instead of writing

    Code:
    int nValue = 0;
    you have to write

    Code:
    Dim nValue As Integer = 0
    in VB.NET which is very long winded.

    Just my opinion and personal taste of course.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Oct 2001
    Location
    Melbourne, Australia
    Posts
    576

    Re: Difference between c#.net and VB.net

    I think Darwin is right on the Vb.Net being very jumbled. C# is far cleaner and (once you are used to it) easier to read.

    Also, Vb.Net does not support operator overloading. Granted, you may not use it often, but sometimes it is useful. There may also be other things, but I don't know them off the top of my head.

    BUT, C# does not support shared variables (i.e. variables that are static to a method, not a class). Of course, there are workarounds for this.

  4. #4
    Join Date
    Jun 2005
    Posts
    3

    Re: Difference between c#.net and VB.net

    some times you have to stick to the company policy to code this or that way. If you are not restricted then find you fun with either of them. I believe that any average project can be carried out with equal success by coding on any supported CRT language.

    I enjoy C -style ever since so I was glad to jump to C#. It is obvious to me that people have designed this beauty with love in their hearts.

    It is not impossible that VB as well as JavaScript.NET and others have been appended to the .NET project to support "Any language" claim.
    +&up;

  5. #5
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: Difference between c#.net and VB.net

    Both C# and VB.NET compiles to IL which runs in CLR. That means that C# and VB.NET could have the same features. But they don't. VB.NET is missing some constructs available in C# and C# doesn't implement all features of CLR. This differences are ment by other on this post.

    Personaly, I also prefere C# over net. In fact, I consider Visual Basic to be a historical failure. C# code is better structure and easier to read. Thats my opinion.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  6. #6
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Difference between c#.net and VB.net

    Personally I believe that VB.NET was added so that VB6 people didn't feel left out. Mind you according to statistics VB6 people are having real trouble changing to the object-oriented world of .NET, whereas C++ have no problems with C#.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  7. #7
    Join Date
    Mar 2005
    Location
    Chicago, IL
    Posts
    69

    Re: Difference between c#.net and VB.net

    What about the capabilities?

    Can VB.Net do every thing that C# does , I mean can we implement the same functionality in both the languages... are there any "if's" and "but's"...
    There has been an alarming increase in the number of things I know nothing about .

  8. #8
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Difference between c#.net and VB.net

    I think we've already covered that. No - C# has more things that it can do that VB can't than things VB has that C# doesn't.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  9. #9
    Join Date
    Jun 2005
    Location
    Turkey
    Posts
    54

    Re: Difference between c#.net and VB.net

    well i wonder why does the microsoft certified tecnical education centers usually teach VB.net instead of c#(It is in my country)? Is it like this in other countries?

  10. #10
    Join Date
    May 2009
    Location
    .NET 3.5/VS 2008
    Posts
    7

    Re: Difference between c#.net and VB.net

    I'm a VB6 programmer and when i first saw VB .NET and tried to learn it it was **** near impossible, they changed everything and made it completely different, VB6 is dead, but its still the most widely used language in the world. So now i'm learning C# from scratch and not even going to VB .NET i know Vb6 too well and i'm too comfortable with it so C# is my choice.

  11. #11
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Difference between c#.net and VB.net

    perhaps some day they will be as cool as indexed properties in C++/CLI which I miss in C#, they are replaced with get_Something and set_Something methods
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  12. #12
    Join Date
    May 2007
    Posts
    1,546

    Re: Difference between c#.net and VB.net

    some day they will be as cool as indexed properties in C++/CLI which I miss in C#
    What is the difference between C++ indexed properties and C# indexed properties?
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  13. #13
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Difference between c#.net and VB.net

    a C# class can have only one indexed property, the "this", whereas a C++/CLI class can have multiple indexed properties that can have any name
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  14. #14
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,786

    Re: Difference between c#.net and VB.net

    Naturally in the C# area of a forum most people would say they prefer C#. If the thread was posted in the VB.Net section the answers would be a bit different.

    The fact is that both are very good languages and can do many many things. Which is better depends on who you are and what you are doing. If you are a former VB or VBA coder then VB.Net is much easier to code in than C# simply because of the fact the C# is case sensitive and requires the use of ; after every line of code both of which are things that may trip up a coder who is not used to this. C# on the other hand would be easier for someone who has coded more in C/C++, Java or other similar language.

    Personally I find C# code to be a bit longer and harder to follow but that is because I have only used C# and Java script on a few occasions and have been writing in different versions of VB for many years.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center