tags:

views:

4094

answers:

15

As a student, I don't often get offers for programming jobs, however I was offered a job if I learned C#. I currently know Java, PHP, C/C++, and other supporting languages. What would be the best way to pick up this language quickly? What are its similarities, what are its differences, pitfalls, etc? Is it acceptable to use Mono, because I really don't want to boot into windows to learn it.

+5  A: 
Gary Willoughby
This book is the only book I have in my office. It is supremely valuable.
Jacob
I completely agree with this - excellent book!
Terry Donaghe
+4  A: 

C# is very similar to Java, so a transition should be fairly painless as far as simple code goes. I got my feet wet in a Windows Programming course, using Programming Microsoft Windows in C# as a guidebook. I know you want to approach it from a linux front, but I'd still consider the book useful as it explains the language well, and the Windows side is simply the application of the language.

Read some simple programs and learn the syntax differences, then try writing some small programs and go from there.

Erick B
+8  A: 

Is it acceptable to use Mono, because I really don't want to boot into windows to learn it.

Despite the efforts of Mono, etc., C# is a Windows programming language and you will almost certainly be using it to program on the Windows platform. If you really want to learn it, it would be best to learn it on Windows. If you can't stomach running Windows to learn C# you probably wouldn't be very happy as a C# developer and should consider something else instead.

If you do decide to take take it up, pick up a good book to learn the basics and then do what you do to learn any new language: write lots of programs.

Robert Gamble
I can stomach using windows, just linux is my primary OS, and I'd either have to launch a VM or reboot, somewhat of a bother (but if it gets me a job, I'm not going to complain).
Malfist
I disagree. C# is now cross-platform due to Mono and the new version (2.0) brings a lot up to date.
Gary Willoughby
I'll admit that I haven't looked at Mono in the last year or so but I haven't seen any serious applications that use C# in a cross-platform way and would feel safe saying that well over 99% of C# development is done in a Windows-only environment.
Robert Gamble
If you last used Mono more than a year ago you have no idea of where Mono is at now:). Mono and MonoDevelop would fullfill all the needs of the poster wrt learning the C# language (besides Mono provides things like the interactive C# console that will be available from MS only later).
lupus
A: 

use the most common, convenient, and up-to-date tools to avoid bad habits and pitfalls unrelated to the language - that means Windows and Visual Studio (or VS Express or whatever it's called)

unless they're using something different at your new job, then use that of course!

then go through one of the various C# tutorials - it almost doesn't matter which one, though i found http://www.learnvisualstudio.net/ to be very helpful when first starting out in .NET since the IDE was new to me

if your new job is web development, concentrate on the web examples, otherwise look at the desktop examples, or both

then come back to SO and ask lots of good questions!

Steven A. Lowe
+17  A: 

With your C/C++ and Java experience, you should be able to pick up C# fairly quickly. Microsoft's MSDN has a lot to offer. I would go through some tutorials there. I'll bet you'll feel fairly comfortable. Actually C# shops have been explicitly told to hire java programmers if they can't find C# coders.

Mono, however, is probably not appropriate. Unless the project explicitly calls for Mono, you'll most likely be coding in a full Microsoft development stack. Mono lags behind the curent .NET implementation by a few revs. After you get up to speed with the Microsoft development environment, you'll probably find yourself wanting to spend some time outside of that stack (this is tagged "linux", isn't it), but if you want to really get into what most shops are looking for you need to concentrate your initial efforts on Visual Studio. MS has several free editions available for Window, of course.

Good luck and good coding. C# is actually really nice language. The only downside for me is that it's locked into the whole Microsoft stack.

Cheers, - D.

dshaw
I have a VS Pro from 2002 thanks to the MSDN Education Alliance
Malfist
Although Mono is behind it would still allow you to learn the language and use core parts of the framework. As you get further from the core to things like WinForms or ASP.NET things start to get more interesting. If you find yourself wanting to make the transition between .NET on windows and Mono make sure to use MoMa (http://www.mono-project.com/MoMA), a mono migration tool to see if the missing portions of the framework will affect your application.
smaclell
+3  A: 

I would be extremely surprised if the potential employer wanted you to use C# without ever touching Windows. However, with that being said, using Mono is still a fine choice. Mono is compatible with pretty much all of .NET 2.0. Mono is currently working on achieving compatibility with .NET 3.5.

To learn it quickly, I would just dive right it in with an IDE. I personally prefer Visual C# Express http://www.microsoft.com/express/vcsharp/ however there is also MonoDevelop http://monodevelop.com/Main_Page. Then simply start by writing a few short programs. C#'s syntax is extremely similar to Java, so you shouldn't have much problem there. You'll spend most of your time learning the libraries/API.

This is a good reference for the differences between C# and Java... titled "C# from a Java developers perspective"... http://www.25hoursaday.com/CsharpVsJava.html

JP
+2  A: 

I'll answer in parts. First, your existing knowledge makes you a good fit for picking up C# -- you already "speak" Java and C++, which are arguably the closest relatives, so you should be able to do some basic stuff without really learning much.

Second, ask the people who offered you a job if they're a Windows shop or not -- if you're going to use Windows at work, it probably makes sense to at least have a Windows install (even if it's just VirtualBox or something) to toy with at home. Last time I checked, Mono's GUI support wasn't keeping up with what Microsoft was putting out.

As for the meat of your question, I'd say to learn C# like any other language: learn by doing. Pick a small project you've been meaning to do anyway -- automate something that you've been doing manually; write a simple mail client or web browser; write a utility to synchronize two directories. Just start fleshing out the project and look around places like StackOverflow to answer the questions that inevitably come up.

Coderer
+1  A: 

I agree with Erick B, that's exactly how I started too. I took it a step further and after the basic class and book I started reading advanced C# books, my two favorites being Framework Design Guidelines and Effective C# -recently new editions of both were launched). In less than a year I was very proficient in C#. Bottom line is never stop learning, C# is changing very rapidly, I'm starting to learn the new 3.5 features and other people are already blogging about C# 4.0!!

Ricardo Villamil
Just a quick bit of pedantry - if you're talking about C# the language, you're learning 3.0, not 3.5 - there's no such thing as C# 3.5 :)
Jon Skeet
A: 

I also picked up C# a few years ago, at first as simply a hobby. The way I chose to dive in was by picking up a good book from my school library, and dedicating a summer to really exploring the language. I also found it motivating to think of a small project to work on and code up in C#. As you read and learn new features, you will find new places to use them in your application.

Your C++/Java background should make it fairly easy to learn C#. The syntax is very similar, and the type-safe object-oriented design will be very familiar.

When I started, I was using Visual Studio on Windows, and I maintain that it's a great, feature-rich IDE. Moreover, most C# books are written around Visual Studio 2005/2008, and they will reference it's specific UI. That being said, Mono for Linux is very stable, and I believe it can compile/run all C# 2.0 code. Also, there is a great IDE called MonoDevelop which tends to emulate Visual Studio, and the latest version is even compatible with Visual Studio project files. In short, you may be missing out on some of the "ease" of Visual Studio, but you can surely learn and use C# under Mono on Linux.

Scott Wegner
A: 

Well everyone learns differently. There are visual learners, assisted learners, and people who learn from reading. In other words, some people prefer video tutorials, some prefer books, and some prefer learning directly from others (whether it be an instructor or a friend). I think the first thing to assess would be what way you learn best, it's hard to soak in material if it's boring you and you don't enjoy it. If you enjoy reading, you're in luck. There are plenty of books out there for Java developers learning C#, and vise versa. Here are just a few made for people seeking the exact thing you are:

C# for Java Developers - MS Press

.NET for Java Developers Migrating to C#

From Java to C#

C# for Java Programmers

Best of luck!

John T
A: 

Is it acceptable to use Mono, because I really don't want to boot into windows to learn it.

Mono does work fine in 99% of you programs, but MonoDevelop is not nearly as good as Visual Studio (it lacks a debugger, and a GUI designer for Windows Forms among other things) But I was really impressed by all the programs that run flawlessly on mono.

A: 

Outside of a general language/platform book I'd also recommend you read:
Effective C#: 50 Specific Ways to Improve Your C#
More Effective C#: 50 Specific Ways to Improve Your C#

These two books are not language tutorials, but rather they illustrate a lot of best practices, gotchas, and misconceptions.

As far as learning with Mono goes, I think you can learn C# that way. However, half of being productive in .NET is knowing the development environment, so if the job will be using Visual Studio, I recommend you learn that in tandem with C#/.NET.

Daniel Auger
A: 

C# is much easier than Java, in my opinion. Especially if you get to use Visual Studio which I prefer much more over Eclipse (as far as IDEs go).

If you have a decent C background, C# will make a lot of sense, and you will have strong object oriented programming skills from Java, depending on how deep you got into it.

Also, it depends on if you're going to be working on web development or desktop application development.

Not to mention the C# and VB.NET guys are way cooler than Java guys :), mostly because our languages aren't dying and in an old and decrepit state like Java is.

MattK311
+3  A: 

I always recommend Jeffrey Richter's CLR VIA C# book - it's one of the best treatments of the .NET Framework. Since you already know Java, the language transition should be the easy part; I'd focus more on the transition to the .NET environment overall.

David Messner
A: 
CMPalmer