Fog Creek Software
Discussion Board

VB.Net vs C#

I am about embark on the .net learning curve and I am torn between VB and C#.

I have almost no C experience (beyond two intro classes) and I have fiddled with for a couple of days.  I feel like a complete rookie (I have 4 years experience with VB 6 dev ) so it occurs that now would be the ideal time to C#.

Any lawful impediment why we shant be joined?

Wednesday, February 5, 2003

VB.NET and C# tend to be so similar except very superficial syntax differences that I don't think it makes a particular difference which one you learn, particularly since you use a common class API for both. 

Learn one and then pick the other one up in about 2 days.  Doesn't matter which you learn first, IMO.  VB.Net might be a tad easier if you're coming in from a VB background.

Mr Nutty
Wednesday, February 5, 2003

I just recently installed Visual Studio .net and, like you, I had to decide which language to run with.

I'm an avid VB developer but I also have experience with C, C++, PHP, and other C-like programming languages.

That said, I don't see any point in learning  The languages are virtually identical except that is a bit more limited and looks a bit like VB6 code.  C# is the primary .net language, you can't really go wrong using it.

Wayne Venables
Wednesday, February 5, 2003

I'm at about the same point (4+ years of VB dev experience, starting .NET) and chose to go with C# over VB for two main reasons:  so I don't get confused when I go back to VB6, and so I get practice looking at code that *looks* very different (e.g., uses curly braces), even if it's functionally equivalent to VB.NET.

Sam Gray
Wednesday, February 5, 2003

I am leaning toward C#.

One thing I didn't expect was the resentment I feel for not being able to leverage more of my current VB 6 knowledge (such as it is).  I anticipate this wouldn't be as prevalent with C#.

Wednesday, February 5, 2003

Thanks for the input, it is appreciated!

Wednesday, February 5, 2003

Right there with you on the resentment.  Learning the language is the easy part -- but the API being so radically different is making me nuts!

Sam Gray
Wednesday, February 5, 2003

The first (and only) .Net book I've read was a C# book.  I was ready to walk away from VB for good, but I'm getting the sense that the ASP.Net community is largely migrating to VB.Net.  It's hard to tell though, since I haven't come across too many .aspx web pages.

In the long run, you'll probably end up learning both.

Thursday, February 6, 2003

It doesn't matter which one you use, they both have advantages and disadvantages. (Following based on .net 1.0, haven't spent much time with 1.1)

For example, C# allows you to use unsigned ints/longs and doesn't. This is actually a win for VB because the unsigned variable types are not CLS compliant (i.e. if you want other languages to call your methods)

In another example, C# is case sensitive and allows you to create public method1() and Method1(). The problem here is that this results in non CLS compliant code, since CLS is case insensitive.

One of the biggest wins for C# is that it allows you to embed XML-formatted documentation into the code (kinda like javadocs) Why VB.Net doesn't have this feature kills me to this day.

I know some of you hate the new API but for someone like me who went from VB6 to Java to .NET, it's like the best of both worlds (windows gui/performance & an object-oriented class library)

Thursday, February 6, 2003

I am a mostly-VB developer who has found he really likes C#.  It just feels nice and clean to me, and making the break to a new language syntax actually helped in adjusting to the new underlying framework.

My first .NET project was in VB.NET and I found the (superficial) similarity to VB more confusing than helpful.

Eventually I will go back and do another VB.NET project, like others I expect to end up learning both.

Matt Conrad
Thursday, February 6, 2003

I didn't mean to give the impression that I hate the new API -- on the contrary, I can tell that a huge amount of thought went into it, and so far, it's pretty fabulous.  It's also huge.  Just *learning* it is what's making me nuts.  ;>

Sam Gray
Thursday, February 6, 2003

I too faced the language choice dilemma.  In college I used C++ almost exclusively, but for the past three years have been using VB at work.  I chose to use VB.NET for new work, for several reasons.

First, I'm the lone developer on my projects, and want to increase the odds of eventually getting someone else on the "team".  Plus, if/when I leave, I want to make it easier for my employer to find someone to take over.  The lowest-common-denominator/highest-common-factor aspect of VB.NET is an important selling point for me.  Because of this, there are fewer uber-geeks in the VB culture, but that's a price I'm willing to pay.

Second, I prefer the more verbose VB.NET equivalent of curly-braces.  Yes, it takes more typing, but not that much more if you use IntelliSense to your advantage.  I think it makes my code just a bit more self-documenting than I would otherwise get using C#.  Some feel the VB style makes the code less aesthetically clean, but then wouldn't commenting your code create the same cleanness problem?  I prefer explicitness over cryptic cleanness.  It's a similar idea to "premature optimization is the root of all evil."  I think of curly braces as a form of premature optimization.

Third, an unintended side-benefit of learning to do things the VB.NET way is that I've learned a lot more about the VB problems that VB.NET solves.  So it helps me understand better the work-arounds necessary to achieve object-oriented results when I need to do old-fashioned VB 6 work.  Reading Francesco Balena's excellent "Programming Microsoft Visual Basic .NET" book has helped a lot with this, as he also includes his "Programming Visual Basic 6.0" book on CD with it, with many comparisons and references to VB 6 techniques from the VB.NET text.

The best thing you can do though if you pick VB.NET is make sure you're fluent in C# too, since you will often find in your reading that articles on the more advanced .NET concepts are often demonstrated only in C#.  Plus, if the next version of C# supports generics, iterators, anonymous methods, and partial types, but they didn't get around to implementing VB.NET support, I would seriously consider moving primarily to C#.  I have run into an instance where I'm forced to work in C# to perform alpha-blended drag-and-drop because a GDI (not .NET's GDI+) function call requires a pointer, which requires you to use C#'s "unsafe" code section.  But for everything else, VB.NET is functionally equivalent and preferable to C# for my needs.

Thursday, February 6, 2003

There are a number of reasons to use either language.  My biggest complaint about VB.NET is all the backward compatibility Microsoft included so everyone can upgrade their current VB6 apps to VB.NET.  Personally I feel it makes the language messy and difficult to use because you're never sure if you're doing something the .NET way or VB6 way. 

Dim x as String = "hello"


Dim x as String = "hello"

Which one is correct
Messagebox or MsgBox, Len or .Length.

Here's what I do, use both.  I write all components in C# because it offers some language and documentation features VB.NET is lacking.  I use VB.NET to write full applications.  It's much faster to code and debug in VB.NET then C#.  The notion of cleaner code is simply personal preference; both languages produce well formatted source code, so why limit yourself to just one language.

Monday, February 10, 2003

*  Recent Topics

*  Fog Creek Home