What's missing in VB.NET and C#?

Roy has made a very nice list what is missing in his opinion in VB.NET and C#. I listed Roy's points below which I totally support, and I added my own wishes too:

VB.NET

  • No more underscores ('_') to break lines!
  • Multiple lined comments!
  • XML comments (this would be in the next version I read).
  • Edit and continue.
  • C# property style: no more Readonly statements, if there is no Set, than the property is Readonly!
  • C# casting style "(type)".

C#

  • Background compilation, underlining errors!!!!
  • Case insensitive, since there are case insensitive languages that can use C# assemblies.
  • VB.NET-like Intellisense for enums and namespace writing.
  • Automatic creation of "()" on method calls.
  • With statement!
  • Edit and continue.

12 Comments




  • I have always thought VB.NET was missing a programming syntax, on top of a few thousands other things. Glurp!


  • Wow, what a nice comment Stephane! It's really adding something to the discussion. Thx!

  • Huh. Forgot about edit and continue, how that for forgetful?? Its my single most important gripe that its not there....


  • Let me the first of hopefully many to correct you both in that C# has Edit and Continue in VS.NET 2003 (which has been out for some months).

  • Since I am a C# developer with C++ background, please let C# case sensitive! Regarding the With statement, it's hard to convert VB.NET samples to C# because of the missing WithEvents statement.

  • C# is also missing a background compiler, which helps greatly with IntelliSense.





    VB.NET is missing operator overloading.





    C# is missing a simple mechanism for late binding.





    VB.NET is missing unsigned types.





    C# is missing optional arguments.





    VB.NET is missing unsafe code.





    The list goes on and on.





    And to clarify a previous post, VS 2003 does NOT provide Edit and Continue for VB.NET or C#.

  • 'With' and 'WithEvents' are two completely different things!



    'With' allows you to reference an object without having to specificy that object each time, eg:



    With Form1.Controls.TextBox1

    .Text = ...

    .Enabled = ...

    End With



    (simple example, but sometimes you have to set a lot of properties on an object multiple levels deep).





    WithEvents is short hand for [event] += New System.EventHandler([eventHandler])

  • It seems to me that VB6 nonsense like WithEvents and optional variables just gets recompiled, anyway. I can't see how you can have a concept like delegates and then break it by pretending events are sent by variable name, not by object. And as for optional arguments...i constructed a class in VB and another in C# that had nothing but a constructor which made three assignments. In VB, I made them optional. In C#, I made 8 seperate constructors for each of the possibile ways to call the constructor (which them called the most complete constructor with their own defaults). I compiled them both with the same switches and dependencies...the VB file was 20% larger. Implies to me that it's coding each calling signature as its own individual method. I'll stick with doing it myself, thanks.

  • I would find it really useful if within a with block I could refer to the with object directly. This would enable me to pass the object as a parameter to a method for example. In the english dictionary this concept is



    with myObject.subProperty.subProperty

    .property1 = value

    myString = .property2

    myOtherObject.Method( ~ , value2 )

    end with



    'instead of...

    dim tempRef as ClassName = myObject.subProperty.subProperty

    with tempRef

    .property1 = value

    myString = .property2

    myOtherObject.Method( tempRef, value2 )

    end with

    tempRef = nothing








  • oops, I forgot to finsh the sentence. It should read: In the english dictionary this concept is denoted by the tilda character (~)

  • I'm only going to comment things that are NOT going to be implemented in the next version of .NET Framework.



    1. Property ReadOnly is good for readablity. It should be "C# is missing Readonly".



    2. CType is used in VB (compared to (type) in C#). Which is better is a matter of taste.



    3. VB is missing a way to turn the background compiler off. In large projects it can get very slow.



    4. C# can use unsafe code. Good or bad? Bad if you ask me, because you should avoid using unsafe code.



    5. VB has optional parameters. Good or bad? Not sure myself so I try to avoid using them (uses overloading instead), in fact I haven't used them so far.



    6. C# is missing WithEvents. In my opinion WithEvents is great for readabilty and fully sufficient in many cases (not all though).



    7. C# is missing implements object.Method. In VB you specify which method that implements an interface. Great for readabilty and flexibility.



    I'm sure there is much more, but that will do for now.

  • I program in both C#.NET and VB.NET and have experience in VB, C++, and Java.

    In .NET 2003, at least, C# supports continue. I whish VB.NET would as well. In my experience, VB.NET is too verbose. WithEvents, ReadOnly, Implements, are just a pain.



    Overall, I think C# is preferable, and I hope it never degrades to the point of losing case-sensitivity. Laslty, if you call a method, add your own (). There's no excuse for being lazy.

Comments have been disabled for this content.