views:

741

answers:

7

I have been coding exclusively for a while now on Linux with C++. In my current job, it's a Windows shop with C# as main language. I've retrained myself to use Visual Studio instead of emacs ( main reason is the integrated debugger in VC, emacs mode in VC helps ), setup Cygwin ( since I cannot live without a shell ) and pickup the ropes of managed language. What tools, books, website ( besides MSDN ) or pitfalls do you think I should check to make myself a more efficient Windows/C# coder?

A: 

Get yourself a copy of Resharper. It's probably the single best productivity tool out there for straight up coding.

Mike Post
+3  A: 

Since you already know how to program in C++, check out:

A Programmers Introduction to C# 2.0, by Eric Gunnerson and Nick Wienholt http://www.amazon.com/Programmers-Introduction-C-2-0-Third/dp/1590595017/ref=pd_sim_b_3/102-6809045-4740138?ie=UTF8&qid=1079114993&sr=8-1

Nice balance between language reference and general .net information.

Similarly: Essential .NET, Volume I: The Common Language Runtime by Don Box and Chris Sells http://www.amazon.com/Essential-NET-Language-Microsoft-Development/dp/0201734117/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1222320480&sr=1-1

Really interesing "under the covers" net book (but written for .net version 1 so may be a little out of date).

s t
+1  A: 

Read about garbage collection in .Net (http://msdn.microsoft.com/en-us/library/0xy59wtx.aspx). People coming from C++ land are used to the explicit memory allocation and management. In C# explicit memory management is virtually non-existing.

Another topic you should check out is the difference between C# generics and C++ templates. I don't have a good link for that one, though.

Depending on the product you are working on, you might have to resort to calling Win32 API functions from C#. This is done through P/Invoke, so you might want to read a bit about it as well. And if you have to actually use it, http://pinvoke.net is very useful collection of C# declarations for most of the Win32 APIs.

You might also want to learn at least the basics of COM, as very often C#/.Net applications choose/need to reuse components from third party vendors, which are often implemented as COM components. COM is a complex topic though. My favorite books on COM and Essential COM by Don Box and Proffesional DCOM by Roger rimes. I would borrow these from a library, as all you need to read are the first few chapters (unless you want to go in depth).

A basic understanding of windows, messages and message queues is necessary, if you are going to write client applications. You will be using Winforms of WPF/XAML for these, and both technologies do a good job of isolating the details from you; however to be able to write good code you need to know what is going behind the scenes. I am not sure what a good book would be for that, but MSDN has lot of information.

Franci Penov
A: 

Shouldn't be the base the CLR? And shouldn't it be unimportant which .NET language is used? If I look through the .NET docs I can decide if I'd like to see the stuff in VB.Net, C# or C++. So if you know C++ why shouldn't you use "managed C++"?

Regards Friedrich

Friedrich
Doesn't quite work like that. Managed C++ is still C++ and IIRC C++ doesn't have a garbage collector by default.
ConcernedOfTunbridgeWells
C++/CLI is *NOT* C++, although the syntax is fairly the same and it is quite compatible at a basic level. It is a whole new language. It uses a garbage collector for managed code. Only unmanaged code must be handled manually.
Terminus
I'm quite aware about that but it's C++, and getting an GC working with C++ is no brain surgery either just take the Boehm-Weisser Gc
Friedrich
Managed C++ exists mainly as a bridge language where managed code needs to interoperate with legacy C++ code. There aren't (as far as I know) a lot of people who prefer it's syntax over C#.
munificent
A: 

My background was predominantly C/Unix and Python with some java and dusty 2000-vintage VB6 when I first used C#. I was familiar with managed runtimes from the work I had done with Java and the .Net API's have a somewhat similar look-and-feel to earlier MS API's.

I found Troelsen's Pro C# and the .Net 2.0 Platform to be a really good C#/.Net resource. There are more recent editions out now.

ConcernedOfTunbridgeWells
+11  A: 
Pop Catalin
+2  A: 

Check out petzold's dotnet book zero. This might help.

http://www.charlespetzold.com/dotnet/