views:

207

answers:

6

I am looking to switch to C#. I come from a C / C++ background but C# is a little different for me. I am switching mainly because of Silverlight and MVVM; all examples are in C#. Any information is in C# and I am confused when I read through it all.

What is a good place to start learning C# when starting with existing C / C++ knowledge?

+1  A: 

Read the best C# books. :)

Parappa
+12  A: 

Start writing code in C# ASAP. Only way to learn the language is to write it. You already understand VB.NET. You've got a huge lead on anyone new to .NET.

Take a smallish application you've written in VB.NET and methodically change it over to C#.

You'll learn the syntax, etc. quickly.

Write all of your future projects in C#. Just force yourself into the change and you'll do fine.

Terry Donaghe
+1 - the only correct answer is just start doing it.
David M
+1 Nothing beats experience. Just keep a keyword comparison reference open. i.e. http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET
Jason w
Agreed! Just dive in and start programming!
Joshua
Thanks Guys.. I guess just get off my tail and run ;)
Rico
Ditto and learn from little snippets here: http://www.java2s.com/Code/CSharp/CatalogCSharp.htm
Steve
A: 

As you know C++ (as you wrote in the question) and VB.Net (as you mentioned in the title), C# won't be hard for you if do know them both well. If this is the case, just grab any source in C#, and read it.

By the way, the article from wikipedia is a very nice intro.

modosansreves
A: 

When I was moving from VB.NET to C#, I use to like to take my VB.NET code and throw it into a VB.NET to C# convertor application. While not perfect, and definately a learning tool, gave me something where I could get a real example of something I did and had interest in converting.

Online Converter Tool

After a while you just start to pick it up and need less reliance on reference materials.

George
+1  A: 

Shortly after learning VB.NET I decided I'd rather be coding C#. I learned it by reading a couple of books and working on a project. Slowly, I got my coworkers converted over to the language from VB.NET as well. The languages are very similar, some code conversion is just a matter of changing syntax.

However, if you've ever worked with a true VB'er you will see VB specific functions used in their code that'll make you scratch your head. There are string handling functions and casting functions for example that you will have to convert. Also, C# has no RaiseEvent. Events take a little more effort to understand in C# because you need to wrap your mind around delegates (C++ function pointers/callbacks). As others have said, if you are coming from C++ this shouldn't be too difficult.

Many people go on about needing to work on a project to understand a language, which I agree with. However, there are features of languages which you will never know about if you don't pick up a couple of books and read about them. I've been able to show my coworkers many useful techniques just by reading a couple of books.

Lastly, C# is a great language. I was very skeptical when I first started using .NET, but now I know that MS got the right talent together for that framework and language.

Good luck.

Nate
Hey man good reply thanks for the info.I believe a book will have to be read as well :). Especially to implement silverlight and MVVM properly
Rico
+1  A: 

The Wikipedia article "C Sharp (programming language)" is a decent introduction to C# as a language.