Monday, August 02, 2004

Things vb.net can do that C# can't

Because of the past differences between Microsoft® Visual Basic, Microsoft Visual C, and Microsoft® Visual C++, many developers have the impression that Microsoft Visual C# .NET is a more powerful language than Microsoft Visual Basic .NET. Some developers assume that many things that are possible in Visual C# .NET are impossible in Visual Basic .NET. Visual Basic.NET can do some thing more that C# can do.
1. One key VB.NET feature is that it eliminates an entire class of runtime error you get in case sensitive languages - where a method parameter and property in the same class have the same name but for case. These problems can only be found through runtime testing, not by the compiler. This is a stupid thing that is solved in VB.NET by avoiding the archaic concept of case sensitivity.

2. Vb.NET supports some operators like \ (Integer Division) and ^ (Exponentiation)
Which C# doesn’t supports?

3. Handle multiple events in single method (superior separation of interface and implementation).

4. With Events is a huge difference in general, since it dramatically simplifies (or even enables) several code generation scenarios.

5. In VB you can actually tell the difference between inheriting from a base class and implementing an interface. In C# the syntax for both is identical, even though the semantic meaning is very different.

6. Implement multiple interface items in a single method (superior separation of interface and implementation).

7. Also, independent naming/scoping of methods that implement an interface method - C# interface implementation is comparable to the sucky way VB6 did it... (superior separation of interface and implementation).

8. Multiple indexed properties (C# only allows a single indexed property).

9. Optional parameters (important for Office integration, and general code cleanliness).

10. Late binding (C# requires manual use of reflection).

11. There are several COM interop features in VB that require much more work in C#. VB has the ComClass attribute and the CreateObject method for instance.

12. The Cxxx () methods (such as CDate, CInt, CStr, etc) offer some serious benefits over Convert.xxx. Sometimes performance, but more often increased functionality that takes several lines of C# to achieve.

13. The VB RTL also includes a bunch of complex financial functions for dealing with interest, etc. In C# you either write them by hand or buy a third-party library (because self-respecting C# devs won't use the VB RTL even if they have to pay for an alternative).

14. The InputBox method is a simple way to get a string from the user without having to build a custom form.