tags:

views:

795

answers:

11

I'm trying to bring myself up to speed on C#, having never developed for it before. In a previous question I asked about good book review sites, and through that I found a very positive (beginner-oriented) review for "Essential C#" but it was for a previous edition.

While I'm sure that it will still be a good book even if the quality dropped between versions, it raises an interesting question for me:

When beginning a new language, is it best to start with the latest version (e.g. C# 3.0/.Net 3.5) or should I go back a version or two and try to learn what got added to the language afterward?

The former seems better from the point of view of being up to date immediately, but the latter seems more pragmatic in that it's probably more likely a shop will be using a slightly older version of the language.

+7  A: 

Start with the latest. If you need to work with code built on a previous version, you can then learn the differences between version X and version Y.

Dana
+16  A: 

I would suggest you start a project with the latest. You do not necessarily need to learn all the newest enhancements, but they will be readily available to you when you are ready.

3.5 is actually the 2.0 framework, with 'additions'.

Also if you are in the process of actually working through the samples, they should work in the latest. Then as you are comfortable, you can look for areas to enhance using the latest version. E.G. Maybe a Loop with Nested IF's could be enhanced to use LINQ.

Brian Schmitt
I've encountered problems using LINQ with 2.0-apps I believe some parts of LINQ assemblies are compiled against 3.5 (e.g. LINQ2SQL). So, you might as well program in 3.5 BUT target the 2.0 framework first.
chakrit
chakrit, I respectfully disagree with that. If a new user stumbles across example LINQ code, it is not going to work when targeting 2.0.
Jason Jackson
+4  A: 

The .NET framework 3.0 and 3.5 are based on 2.0, so I'd say you're best off to focus on 2.0 features and then add on 3.0 and 3.5 stuff as you go.

Just make sure to avoid anything before 2.0 because they broke backwards compatability with version 2.0.

chills42
+2  A: 

Go with .NET 3.5 and C# 3.0. Doing otherwise just starts you farther behind. Besides, the core facilities are the same across versions. But, when you're ready for LINQ, for example, it's there ready for you!

rp
+2  A: 

I'll answer your question by asking you a question.

Would you rather work in a business that uses the latest version of C#/.Net or a business that uses an older version?

Ed Guiness
+3  A: 

Start with the latest.

There are some goodies in the later versions that are not in 1.0. You don't want to start "bad" habits of using workarounds that are fixed in the latest version.

Robert
+1  A: 

To address your question of adoption, since the transition from version 2.0 to 3.5 is not prohibitively painful for many software shops, I'd go ahead and start with 3.5. You'll implicitly know 2.0, although perhaps some of the idioms will have changed.

Jeb
A: 

If you are doing freelance contract work I think learning the old stuff is better. Must of the code you will be touching will be old. If you are employed and have to use the language to come up with a new app or you are doing it just for fun then I would chose the latest and greatest.

Clutch
+1  A: 

Learn the latest, absolutely. Why, for instance, would you want to get in the habit of using pre-generic C# containers, and then have to unlearn that? Read up on the older stuff as you encounter it in old code.

Dustman
A: 

You might want to look at this question and answers

dove
+2  A: 

Learn the latest - but try to make sure you're rock solid on the language features from C# 1 and 2 rather than just learning the cool stuff from C# 3. Apart from anything else, you're still going to see straight C# 1 in many maintenance jobs.

It's worth being aware of how different features are implemented - in C# 2, nullable types and generics required CLR changes, but the rest (iterator blocks, anonymous methods, partial types etc) were just compiler magic. In C# 3 it's all compiler magic (with framework support for LINQ etc). You should really understand the fundamentals in CLR terms (what's a struct? what's a class?) and CLR via C# is a great way of learning this. Concentrate on the core technologies (the System.* types, IO, collections etc) before worrying too much about ASP.NET, WinForms, WPF etc. I'd include LINQ to Objects as a "core" API but not LINQ to SQL, for example.

I have Essential C# on my reading list at some point (for review purposes) - I've had a quick flick through what it offers, and it seems solid and thorough.

Jon Skeet