views:

636

answers:

13

I want to learn C# (on Linux, so using Mono), and I'm looking for some guide that taps into the knowledge I already have of other languages; most notably C, C++ and java (but also python, Haskell, lisp, and perhaps a few others).

So far all I've found on the web are combined introduction-to-programming and introduction-to-C# texts, but they all fail because I get bored and can't stick to my learning plan.

Does anyone have a suggestion for something good to read?

Broadening this question up, how do you learn a new language that's similar to languages you already know in a way that taps into the knowledge you already have? Do people write these kind of tutorials? Do you just grab a cheat sheet? Do you have an array of exercises you force yourself through?

Edit: I don't know any other Microsoft development... thingies. I wrote a little bit VB around eight years ago, but I don't remember any of that. I have no ASP experience, no experience with anything else .NET, no MS languages or libraries. Even though I have developed on Windows, I haven't done capital-D Windows Development. Please consider this when making a suggestion.

+4  A: 

Read highest voted C# related questions on Stack Overflow.

Anwar Chandra
While this is certainly useful and even fun, I really don't think it's a good way to learn a programming language.
Andreas Bonini
@Koper: Different people learn differently. The OP sort of implied that he had hard time following the traditional routes. Reading up on "all the cool and unexpected stuff" on a topic instead is a viable way of learning… (I don't know about you, but this kind of stuff is right up my alley).
Spoike
+10  A: 

If you already know the above languages, I would suggest that you assume that you know the language already and dig into the more interesting .NET stuff, such as CLR via C#, which I can reccommend very highly (but not so sure how much it applies to Mono though). The gaps in your language knowledge will fill themselves in.

Joe
+2  A: 

As you know C++ you are already familiar with C# syntax. But its not enough, you need to get yourself familiar with .NET architecture.

how do you learn a new language that's similar to languages you already know in a way that taps into the knowledge you already have? Do people write this kind of tutorials? Do you just grab a cheat sheet?

Of course you an learn new language if you already know any language by understanding differences between the two. But C# is designed as a entirely different language and share only a part of syntax of C++.

Do you have an array of exercises you force yourself through? Do you have an array of exercises you force yourself through?

If you know .NET architecture, things will start easing out for you, after that you need not write program in C#. You can even write it in plenty of languages supported by .NET, C# will be easy for you as it share same syntax as that of C++.

Also have a look at

Xinus
+4  A: 

I suggest you read C# 3.0 in a nuthshell. It is especially aimed for programmers of other languages. Here is a review by Jon Skeet

Andreas Bonini
Why is "Here" the link text for the review-link? Wouldn't "review by Jon Skeet" be a much better link text? ;-)
SealedSun
A: 

Read some basics from a book / website and go to implementation- that is the best and fastest way to learn ( and usually you won't get bored in the way, maybe just hanged b/c some knowledge is still missing... --> google)

Dani
A: 

If you're experienced in Java this C# vs Java page goes over all the points that would likely trip you up by assuming that things work in a certain way.

cyborg
A: 

I would recommend you professional C# programming books as they mainly focus on a programmer point of view. Such as Professional C# 2008 (ISBN: 978-0-470-19137-8. Wrox Professional Guides.)

Tadeze
+3  A: 
  1. Pick up a real project. Then you will face real problems.
  2. Find person who already knows C# well. He may give you valuable advices.
  3. Get a good book such as C# 3.0 Complete reference by Herbert Shildt. MSDN is good, but sometimes it is easier to read a good book than documentation.
Sergey
+1  A: 

Collect "Mono: A Developer's Notebook", or "Practical Mono" or "Open Source .Net Development: Programming with NAnt, NUnit, NDoc, and More".

The second one is very well-written.

JMSA
Accepted, because it's the only answer that addresses the "On Linux, using Mono" bit of my question. (Maybe I should have emphasised that some more?)And the suggestion (by Sergey) to undertake "A Real Project(tm)" is of course a good one, and one that I know to do, but it doesn't tell me the things I want to know but *don't* know (yet).
Jonas Kölker
Since you have worked in Java, search the web for .NET ports of Java frameworks. If you are going to work with Business Software, you need to master the database access techniques. Some O/R mapping tools like NHibernate will be handy. For other types of software like graphics, there are highly sophisticated libraries like MOGRE, etc. If you have decided to work in AOP, you can take a look at Spring.net.
JMSA
No "C# In Depth"? :D
moogs
+3  A: 

I agree with cyborg's comment that C# is very close to Java. So close, in fact, that it can make you a little suspicious of what's going on at Microsoft behind closed doors - but I digress...

It's all about options so here are a few off the top of my head:

1) Use a Java vs C# guide like cyborg recommended, but realize that for the most part those typically cover just syntax changes (the link he posted is pretty darn good). There are still a ton of changes to get into if you're developing desktop applications or web applications. For example, I found ASP .NET to be a HUGE difference from JSP. The bottom line is that your Java experience will only take you so far, but to be able to produce enterprise applications you will have a lot of new learning to do.

2) Dive in. I remember writing this on another message board for someone with a similar question...pick an application that you want to write for fun (board game, contact manager, todo list with an alarm clock). Make sure whichever application you write uses the basic fundamentals that you need for the real world (data access, network, etc). Write the application and then throw it away or do a major review and refactor. Do this 2-3 times over making improvements each time and you'll be in pretty good shape.

3) Get a good book. This can obviously be combined with 1 and/or 2. Make sure the book focuses on fundamentals first (OO, syntax, best practices). Shameless plug in 1...2...3...check out http://asteio.com for an online resource if you want to go the eLearning route (although my site is a little more expensive than most).

asteio
+1 for "dive in". Definitely the best way to learn any programming language, imho.
Phil Booth
A: 

For the language itself, is not hard. What is hard is to learn how to use the huge framework.

Benny
+1  A: 

C# is something of a "next-generation" Java, and Microsoft's old Java team did a lot of the development work on the language (plus Anders Heilberg, of Borland Pascal and Delphi fame).

There are two essential improvements in C# over Java.

  • C# generics have a better implementation, with the huge improvement being that in C#, generics retain full type information at run-time. This will improve even more in C# 4.0, with covariance and contravariance.
  • LINQ (Language INtegrated Query) gives you a SQL-like query language that is fully integrated into C#. You can query object collections, XML, databases, web services, or anything else. The .NET framework includes interfaces for developing your own LINQ data providers, so there are essentially no limits on what LINQ can query.

So probably the best way to approach C# is to think first in terms of Java, and look at the enhancements. Jon Skeet's C# in Depth might be the best starting point; it will cover all the real meat of C# that differs from other languages.

Cylon Cat
A: 

Learning C# is not only learning about its keywords and syntax. It's also (and perhaps, most importantly) learning about its idioms, runtime environment, overall philosophy, libraries, and other associated stuff.

On books, I would suggest C# in Depth by Jon Skeet. It's not Mono-oriented, but it will definitely teach you the insides of C#.

CesarGon