Results 1 to 11 of 11

Thread: advantages of C# over vb.net ??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Location
    india
    Posts
    95

    advantages of C# over vb.net ??

    im facing many interviews. but most of the companies asking C# only.

    why? for what reason they prefer c# as codebehind?

    We can acheive the same thing from vb.net also no. is there any advantage in C# than VB.net?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: advantages of C# over vb.net ??

    # XML documentation generated from source code comments. (This is coming in VB.NET with Whidbey (the code name for the next version of Visual Studio and .NET), and there are tools which will do it with existing VB.NET code already.)
    # Operator overloading - again, coming to VB.NET in Whidbey.
    # Language support for unsigned types (you can use them from VB.NET, but they aren't in the language itself). Again, support for these is coming to VB.NET in Whidbey.
    # The using statement, which makes unmanaged resource disposal simple.
    # Explicit interface implementation, where an interface which is already implemented in a base class can be reimplemented separately in a derived class. Arguably this makes the class harder to understand, in the same way that member hiding normally does.
    # Unsafe code. This allows pointer arithmetic etc, and can improve performance in some situations. However, it is not to be used lightly, as a lot of the normal safety of C# is lost (as the name implies). Note that unsafe code is still managed code, i.e. it is compiled to IL, JITted, and run within the CLR.
    From: http://blogs.msdn.com/csharpfaq/arch.../11/87816.aspx

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: advantages of C# over vb.net ??

    A lot of this changes with 2.0, though.

  4. #4
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: advantages of C# over vb.net ??

    I think one of the main things is the unmanged code.
    We currently have a data access library that's written in VB.NET
    This works fine, but since SQLConnections are unmanged then they don't get cleaned up straight away when destroyed.
    This has led to some huge problems with our web apps on our servers, which have a user base of over 30,000. We kept running out of room in the connection pool simply because VB.NET doesn't toast the unmanged resource.

    So, this means that VB.NET is not good enough to write large enterprise level apps...this does sound stange, but it's true, and MS admit this is a "feature"! *sigh*

    VS 2 will allow VB.NET to deal with unmanged code, but for the time being we have had to rewrite the data access class in c#, which has the Using command.

    Woka

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: advantages of C# over vb.net ??

    Quote Originally Posted by Wokawidget
    I think one of the main things is the unmanged code.
    We currently have a data access library that's written in VB.NET
    This works fine, but since SQLConnections are unmanged then they don't get cleaned up straight away when destroyed.
    This has led to some huge problems with our web apps on our servers, which have a user base of over 30,000. We kept running out of room in the connection pool simply because VB.NET doesn't toast the unmanged resource.

    So, this means that VB.NET is not good enough to write large enterprise level apps...this does sound stange, but it's true, and MS admit this is a "feature"! *sigh*

    VS 2 will allow VB.NET to deal with unmanged code, but for the time being we have had to rewrite the data access class in c#, which has the Using command.

    Woka
    Are you sure about this? I did not know this nor was I aware of SQLConnections in VB.NET being unmanaged. Got any links I can read on?

  6. #6
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: advantages of C# over vb.net ??

    http://msdn.microsoft.com/library/de...poseTopic1.asp

    SQLConnection are unmanaged...but the above article tells you how to destroy them. Cool, so this should work. But it doesn't

    Create a test SQL Server DB with a limited number of connection pools.
    Now write a quick app that opens connection and then toasts them, using the code MS says should work.
    Oh dear...it seems that MS are wrong...suddenly you get errors when creating the connection object.

    The dispose method apparently just flags this connection to be toasted by the garbage collection, but if you have enough memory on your server this may not ever happen.

    Woof

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: advantages of C# over vb.net ??

    Ah, some resources used by SQLConnection are unmanaged. *sigh of relief*

  8. #8

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: advantages of C# over vb.net ??

    Testing in progress..

  10. #10

  11. #11
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: advantages of C# over vb.net ??

    Quote Originally Posted by mahivr
    im facing many interviews. but most of the companies asking C# only.

    why? for what reason they prefer c# as codebehind?

    We can acheive the same thing from vb.net also no. is there any advantage in C# than VB.net?
    VB traditionally is more of a business-use language whereas C and its derivatives (yes I know C# is just a name that happens to contain a 'C') are seen as computer science languages.

    So depending on the companies you are interviewing with - most software engineering companies use C# - whereas if you were applying for jobs at some random corporate business - you would find they were looking for VB programmers.

    C# is also close in syntatical sugar to JAVA and C++, which is what most software engineering companies were using for a long time before .Net became a must-have.

Posting Permissions

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



Click Here to Expand Forum to Full Width