Tech Off Thread

26 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Is Visual Basic inferior to C#?

Back to Forum: Tech Off
  • User profile image
    Klaus Enevoldsen

    Is Visual Basic inferior to C#? The reason I am asking this, is because I recently found that there are a few things that Microsoft supports in C#, which are not supported in VB.

    • SharePoint Extensions for Visual Studio 2005 provides more templates for C# then in VB.
    • The query expressions in C# LINQ contain more possibilities then in VB.
    • The LINQ samples for the Orcas March 2007 CTP were updated for C# within days and the samples for VB is still not available.

    What is going on? Up until recently the main difference in what you could do in VB and C# was the calling of “unsafe” methods.

  • User profile image
    TommyCarlier

    No, VB is not inferior. It's sometimes also the other way around. VB 9 has XML literals, and C# 3 does not (and probably never will). VB has the My-namespace. There are a lot more default Code Snippets for VB than for C#. The only conclusion I can make is that VB and C# have different features because they are built by different teams and they have different goals. Which is a good thing.

  • User profile image
    Raghavendra_​Mudugal

    Wow, Thanks TommyCarlier. Hip Hip Hooray!

  • User profile image
    Maddus Mattus

    TommyCarlier wrote:
    VB has the My-namespace.


    You can use the my namespace from c#, no problem.

    Check Erik Meijer in the video's, he's a VB.Net enthousiast and can explain why VB.Net is actually superior to C#. Wink

  • User profile image
    rhm

    A lot of things: books, websites, 3rd party tools, etc. have more support for C# than VB.NET. It think it's assumed that more people use C#, but I'm not sure that's true - not if all the millions of classic VB programmers upgraded to VB.NET it wouldn't be anyway. But Microsoft has promoted C# as the 'serious' .NET language, so the perception is out there that supporting C# is a must and that VB.NET is a bonus.

    At work I write ASP.NET and Webservices most of the time and the company uses VB.NET for all it's .NET projects. I hadn't used VB.NET before I joined them (although I had used VB6 for many years), but I was a user of C# for several years and convinced them to hire me based on how much transferable knowlege there is between the two as well as my classic VB experience.

    Anyway, my observation is that VB.NET is pretty-much perfect for the work we do. Mostly due to one feaure: the compiler generates code such that in comparisons operations, the empty string is equal to null (Nothing in VB.NET). That saves *so* much redundant typing that you have to put in by hand when you write in C#. OK, there are other benefits to VB.NET and there are also some downsides, but certainly anything you can write in C# can also be written in VB.NET.

  • User profile image
    staceyw

    Klaus Enevoldsen wrote:
    

    Is Visual Basic inferior to C#?



    yes.  Wink

  • User profile image
    littleguru

    VB.NET gets a lot of love from Microsoft. It compiles during entering the code for example. That feature is not found in C#. Other things, mentioned by Tommy, aren't also found in C#.

    It's true that you can use the My namespace also in C#, but that means you need to include a VB.NET assembly as reference (uuuhh, ahh!) to your project. Some my-namespace-things that are generated by the VB compiler and aren't therfore available in C#(well the C# doesn't generate them).

    VB is also way better at late bound things!

    And the best is that you can mix both languages - VB and C#. You need to create two projects in VS, but you can have both in the same solution. If you need the benefits of C#, you can use that language and if you need the benefits of VB, you can use that langauge too. And finally compile them both into the same code!

    All languages work so good together! Isn't the .NET world a great world?

  • User profile image
    Ion Todirel

    littleguru wrote:
    All languages work so good together! Isn't the .NET world a great world?
    indeed it is a great, big and happy world,

    my dream is to be able to use different languages in the same project, like in ASP.NET, compile them to different assemblies and the link together with ilmerge, or something like that...

  • User profile image
    littleguru

    Ion Todirel wrote:
    
    littleguru wrote: All languages work so good together! Isn't the .NET world a great world?
    indeed it is a great, big and happy world,

    my dream is to be able to use different languages in the same project, like in ASP.NET, compile them to different assemblies and the link together with ilmerge, or something like that...


    I think that won't happen - at least not in the near future. Why? Well if you have two classes. Let's say A and B. A has a reference to B in it and B a reference to A. Now you have A written in C# and B in VB. How could the VB compiler compile it without knowing anything of the A class? And how could the C# compiler do the same for the B class?

    This is an example of a circular reference. If you have separate assemblies you won't get them that often (and it's a lot easier to eliminate them) than in a single assembly!

  • User profile image
    ian.coetzer

    Hi

    It is amazing that people are so strongly pro or anti a language.
    However if you look at the world in general there are many things like religion where people have vastly different standpoints!

    Anyway from 'my' experience in the business world - one can write a VB.NET application - and write the same C# application and the quality (if the same 'process' was followed) will be exactly the same.

    So I ALWAYS try and think of the domain/context etc. that the 'language' will be used in to determine whether it is the 'better' language for the job.

    Think about it, i would not try and speak Afrikaans (which is my home language) in America if I'm trying to do business with a large organization ....

    So try not to think of which language is better, rather think of it this way by asking yourself.

    "In this context, which language would be better?"

    And think about things like!

    - functional requirements of the system
    - developer skills ! ! !
    - maintenance, will it be inhouse? do the inhouse developers know that language ? their experience thereof?

    So there are many many things to consider than just plainly making a statement like ...
    language x is better than language y because it is higher up in the alphabet .....

    Smiley just another comment Wink

  • User profile image
    cheong

    Ion Todirel wrote:

    indeed it is a great, big and happy world,

    my dream is to be able to use different languages in the same project, like in ASP.NET, compile them to different assemblies and the link together with ilmerge, or something like that...

    That's something I want to know too.

    I know that we can create 2 separate folders under App_Code in ASP.NET application, one for VB.NET and one for C#, to use both language in the same project. But is it possible to create a partial class in both language, some in VB.NET and some in C#?

    Recent Achievement unlocked: Code Avenger Tier 4/6: You see dead program. A lot!
    Last modified
  • User profile image
    theshadguy

    cheong wrote:
    Ion Todirel said:

    indeed it is a great, big and happy world,

    my dream is to be able to use different languages in the same project, like in ASP.NET, compile them to different assemblies and the link together with ilmerge, or something like that...

    That's something I want to know too.

    I know that we can create 2 separate folders under App_Code in ASP.NET application, one for VB.NET and one for C#, to use both language in the same project. But is it possible to create a partial class in both language, some in VB.NET and some in C#?
    I think if there was a "Hybrid" compiler this would be doable....but thats the tricky part

  • User profile image
    SlackmasterK

    TommyCarlier wrote:
    No, VB is not inferior.


    Somebody remind me what BASIC stands for...  "____ All-purpose Symbolic Instruction Code". If only I could remember what the ___ was.  I wonder how many more people would develop on C-based languages and other more complex languages if there weren't so many ____'s running around afraid of expanding their knowledge of the way the world works.

    ... but yes, different teams with different visions combine to form a good thing. Especially when the two teams' work can be accessed from each other.

    Flames start.... NOW.

  • User profile image
    z2bass

    Heres the thing... THEY BOTH MERGE TO IL. Also, some features in IL aren't yet in C# or VB. They use the same namespaces (Except Microsoft.VisualBasic) and they use the same intermediate language... IL! If the teams would make them the same, they would be exactly the same and code conversion would be SO much simpler... but it's not!

    BTW...

    Dim BG as Microsoft.BillGates
    Dim VBprogrammer as Person
    BG = VBprogrammer

    Its true... Gates is a VB fan!

  • User profile image
    Klaus Enevoldsen

    z2bass wrote:
    Its true... Gates is a VB fan!


    Bill Gates wrote the Basic compiler for DOS, sure he is a VB fan Smiley

  • User profile image
    JosephSpaur - MSFT

    cheong wrote:
    
    Ion Todirel wrote:
    indeed it is a great, big and happy world,

    my dream is to be able to use different languages in the same project, like in ASP.NET, compile them to different assemblies and the link together with ilmerge, or something like that...

    That's something I want to know too.

    I know that we can create 2 separate folders under App_Code in ASP.NET application, one for VB.NET and one for C#, to use both language in the same project. But is it possible to create a partial class in both language, some in VB.NET and some in C#?


    This isn't as easily doable in ASP.NET using the App_Code folder, if you wanted to have part of an assembly written in C# and another part in VB.NET the key is to use modules (C# compiler has a "/t:module" switch that outputs a *.netmodule) Then you can include a module into an assembly using "/addmodule" on the command line compile.

    I've never actually done this (or know anyone that has), but I don't imagine there should be many problems..

  • User profile image
    JosephSpaur - MSFT

    JosephSpaur - MSFT wrote:
    
    cheong wrote: 
    Ion Todirel wrote:
    indeed it is a great, big and happy world,

    my dream is to be able to use different languages in the same project, like in ASP.NET, compile them to different assemblies and the link together with ilmerge, or something like that...

    That's something I want to know too.

    I know that we can create 2 separate folders under App_Code in ASP.NET application, one for VB.NET and one for C#, to use both language in the same project. But is it possible to create a partial class in both language, some in VB.NET and some in C#?


    This isn't as easily doable in ASP.NET using the App_Code folder, if you wanted to have part of an assembly written in C# and another part in VB.NET the key is to use modules (C# compiler has a "/t:module" switch that outputs a *.netmodule) Then you can include a module into an assembly using "/addmodule" on the command line compile.

    I've never actually done this (or know anyone that has), but I don't imagine there should be many problems..


    This doesn't give you exactly what you want as far as multiple languages in a "project", but if you're using tool around your builds (say for automated builds, etc) then this is even easier... (for instance VSTS, scripted MSBuild, NAnt, CoReXT (ms internal), etc.)

  • User profile image
    staceyw

    Ion Todirel wrote:
    

    my dream is to be able to use different languages in the same project, like in ASP.NET, compile them to different assemblies and the link together with ilmerge, or something like that...


    agree. my dream is be able to code c# along side c++ or powershell script blocks or any other .Net language.  Everything is a code block (i.e. just IL with a different face).  IIRC, that is the plan with futures of Bartok compiler.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.