views:

106

answers:

3

I am currently reading Beginning ASP.NET 4: in C# and VB (Wrox Programmer to Programmer) and it comes with both C# and VB.NET source code. I am definitely planning to use C# in the future for most of my projects. But VB.NET - is it really worth learning side-by-side with C#? Are there such cases when VB.NET is preferred over C#?

UPDATE: Thank you everyone. After looking at Cons and Pros of VB.NET vs C# I've decided to focus just on C#.

+1  A: 

if you are coming form java or c or c++ >> use c# because most of the programming syntax are same and you fell comfortable

if you are coming from VB >> use VB.Net because most of the syntax are similar that.

you can you use either VB.NET or C# as per your need there are some difference between that you require to learn/know if you want to work in both.

Pranay Rana
I actually did the opposite when first learning .NET. My background was VB6/VBA, but I elected to do work in C# in a similar multi-language ASP.NET book. (I will note that as the book progressed, the C# examples were often omitted, which is a knock against that book since it didn't follow its stated goal.)
Anthony Pegram
+3  A: 

Well this is the most debatable issue in .NET community and people treat there languages like religion.Its a subjective matter which language is best.Some like VB.NET’s natural style and some like professional and terse C# syntaxes.Both use the same framework and speed is also very much equivalents . But still lets list down some major differences between them :-

Advantages VB.NET :-

Has support for optional parameters which makes COM interoperability much easy.

With Option Strict off late binding is supported.Legacy VB functionalities can be used by using Microsoft.VisualBasic namespace.

Has the WITH construct which is not in C#.

The VB.NET part of Visual Studio .NET compiles your code in the background. While this is considered an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.

Advantages of C#

XML documentation is generated from source code but this is now been incorporated in Whidbey.

Operator overloading which is not in current VB.NET but is been introduced in Whidbey.

The using statement, which makes unmanaged resource disposal simple.

Access to 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).This is the major difference that you can access unmanaged code in C# and not in VB.NET.

Muhammad Akhtar
The is new functionality in C# 4.0 which provides Optional Parameters.
Chinjoo
Thanks for sharing valuable information, I have not still working on 4.0
Muhammad Akhtar
Doobi
"The VB.NET part of Visual Studio .NET compiles your code in the background. While this is considered an advantage for small projects..."Define small projects. A few years ago we have developed a project with more than 2 million lines of sourcecode with no noticeable delay (Win 2000, MS VS 2003, Intel P4 2.0 GHZ, 512 MB RAM).
Tim Schmelter
+3  A: 

My suggestion is to rather focus on just one especially while you're learning. Trying to learn a framework technology like ASP.NET while dealing with two languages is just going to be confusing. (That's from experience)

The great thing about the .NET languages is that once you've learned the one switching is just a matter of syntax, the underlying concepts are the same.

Having said that I'd say stick with C# - it's the more popular of the two, most open source .NET projects use it, and it's syntactically simmilar to many other languages, like Java. But, switching to VB if you need to isn't a big deal.

Books like that prove the point, but are not good to learn from.

Doobi
I disagree about your last sentence. I've been reading this book and so far I am learning a great deal from it. The book has Try-It-Yourself for every section that lets you get hands-on experience and apply what you've learned in practice.
Silence of 2012