views:

399

answers:

10

My company is tossing around the idea of using the Entity Framework when it comes out with .NET 4. We are currently a VB.NET shop, but have some interest in switching to C#.

Is there any major arguments for or against such a move?
Does EF with C# hold any advantages in performance, coding ease, etc over VB.NET?

Thanks for your thoughts/opinions!

+6  A: 

I always stay stick to what you are good at. If there is a large learning curve from vb.net to C# it may be risky. I was a vb.net programmer but moved to C#, I didn't find it all that difficult. But if you are working on some robust software that needs daily changes / fixes you may want to stick what you are good at (in this case VB.net).

Here is a nice comparison between both languages.

When you are comparing both languages for the entity framework you won't find much of a difference. If you prefer public sub with matching end subs (more wordy and verbose) then use vb.net. If you like { } and less wordiness then prefer C#.

I hate to tell people not to learn C# because I'll be quite honest, I wish I would of changed from VB.net to C# a long time ago. I like the cryptic like syntax because I have a C/C++ background. I had to deal with VB.net for a while due to some internal applications. So it's preference and you'll probably be quick to implement everything in vb.net. But if your company is willing to let you guys learn a new language and invest in your knowledge then I say go for C# all the way.

JonH
C# is definitely a good investment! Thanks for your thoughts!
Airn5475
A: 

No substantial differences, and now more than ever VB.NET and C# are going to be kept in sync so it really comes down to your (or your company) preference.

Otávio Décio
+4  A: 

With .NET 4.0, VB.NET and C# have the exact same functionality. The only real difference is the syntax. Before 4.0 that was not the case as there were a number of minor differences. However Microsoft has made a push to make the languages the same. Which is going to occur with the release of 4.0.

RandomBen
Keep up with the marketing lingo, its not .0 anymore its just 4 ;)
Nate Bross
To heck with Microsoft lingo. If they were a smart company they would make less lingo and make better products. I love them but they still need to improve
RandomBen
+1  A: 

If you are primarily a VB programmer, C# can be confusing; all those arcane braces instead of a nice verbose "End Sub"!

For the most part, the languages are otherwise equivalent; both compile to essentially the same IL (although there are occasional differences) and are thus equally performant (for the most part).

Bottom line: it's preference. I prefer C#. You may not.

Randolpho
An I Sir, prefer VB6. Noooo! C# :) +1 for being so true, it's just a different dialect to the same output.
Filip Ekberg
a nice verbose "End Sub" \*spits\* ;)
johnc
A: 

Depends on the team you are working with and the skillbase.

Aim Kai
+7  A: 

I actually have an irrational dislike for vb.net if im honest, i much prefer c# syntax, but there is no compelling reasons to switch. They both compile to IL, with very subtle differences and both are equally capable.

I would imagine that the most compelling reason to switch might be that it is easier to find and recruit high quality c# developers than it is vb.

Paul Creasey
+1 I have a dislike for VB.NET as well, though it's a little more rational. I've come across situations where code that ABSOLUTELY SHOULD NOT UNDER ANY CIRCUMSTANCES COMPILE come back "Build Successful." (One such case allowed code to pass a parameter to a function that accepted none). VB can also implicitly convert variables to types it thinks it needs, while C# will require explicit conversion.
Pwninstein
+2  A: 

I think your biggest issue is not in the difference in performance or capability. I think it will come down to documentation. MSDN will probably provide features in both languages, but the majority of the blog posts, etc will be in c#. These posts may offer real world guidance on best practices, tips and tricks and a host of other information that you will lean on in your development practice and most will be in c#.

Chris Conway
I totally agree with you on this on Chris. I am CONSTANTLY running to Google/Bing to clarify syntax or how to do something. I am at heart a C# guy, but this job came up, so I'm working VB.NETI would love to go back to C# for no reason OTHER than the external documentation and resources found out there.
Airn5475
+1  A: 

One of the most compelling differences for me is that C# generally has a more concise syntax. This manifests itself especially with lambda expressions. Although VB.Net now has the same functionality, I find the VB.Net syntax way too verbose.

E.g., if you use the LINQ 'Fluent API' syntax:

C#

var addresses = _users
   .Where(u => u.Name == "scott")
   .Select(u => u.Address)

Admittedly, the syntax can be a little weird at first, but as soon as you're used to it this actually becomes very readable. Compare this with VB.Net:

Dim addresses = _users _
     .Where(Function(u) As Boolean
                return u.Name = "scott"
            End Function) _
     .Select(Function(u) as Address
                Return u.Address
             End Function)

EDIT: Apparently I was misinformed...

The above code is only valid in VB10 (where they added multiline lambda statements), but can be written more concisely as follows:

        Dim addresses = users _
          .Where(Function(u) u.Name = "scott") _
          .Select(Function(u) u.Address)

Apart from the ugly underscores and the Function keyword instead of the =>, this is mostly the same. Still prefer the C# syntax though ;-)

jeroenh
is that actually valid VB? Normally anyhow, you'd leave the "As Boolean" and "End Function" stuff. For one-liners, VB.NET's syntax is hardly much worse that C#'s
Eamon Nerbonne
@Eamon. Like Eaomon says, the valid VB is not much worse than the C#. `Dim addresses = _users.Where(Function(w) w.Name = "scott").Select(Function(z) z.Address)` But for me it's hard to improve on this VB `Dim addresses = From u In _users Where u.Name = "scott" Select u.Address`
MarkJ
... I realise my second example wasn't "fluent" (by the book) but IMHO it's readable, extremely concise and allows chaining, which are the key benefits of "fluent" AFAIK
MarkJ
@Eamon Nerbonne, @MarkJ the code I wrote was valid VB, but only in VB10. However I overlooked the more concise one-line syntax; updated my answer accordingly.
jeroenh
The whole "Function(w)" is definitely one thing I despise about VB.NET LINQ vs C# LINQ. Another thing is line continuation characters for LINQ statements. Thanks for the multi-line tip. I look forward to it!
Airn5475
About the line continuation underscores - the VB team have removed the need for underscores in some parts of VB10. I don't know whether they removed them for LINQ. Let's hope it's on their list even if they haven't got round to it yet.
MarkJ
A: 

C# is the way to go in my opinion. I can code in both, but much rather C#. The .Net world seems to revolve around C#. I think you're company will find more C# coders out there that are better skilled than you would find VB.net coders.

Eric
I like your choice of words with "revolve". I agree
Airn5475
A: 

I think either language will work. I prefer c# only because their is more documentation out there in c#.

PitneFor