tags:

views:

113

answers:

1

I'm new to .Net world, my primary language was C++ where there are lot of idioms that help code better(RAII,PIMPL...). What are the common idioms available for c#.

+3  A: 

I don't give any idioms, but since you move from C++ it maybe interesting:

MSDN: C# for C++ Developers

The following table contains important comparisons between C# and native C++, which does not use /clr. If you are a C++ programmer, this table will give you the most important differences between the two languages at a glance.

C++ -> C#: What You Need to Know to Move from C++ to C#

C# builds on the syntax and semantics of C++, allowing C programmers to take advantage of .NET and the common language runtime. While the transition from C++ to C# should be a smooth one, there are a few things to watch out for including changes to new, structs, constructors, and destructors. This article explores the language features that are new to C# such as garbage collection, properties, foreach loops, and interfaces. Following a discussion of interfaces, there's a discussion of properties, arrays, and the base class libraries. The article concludes with an exploration of asynchronous I/O, attributes and reflection, type discovery, and dynamic invocation.

Sharp New Language: C# Offers the Power of C++ and Simplicity of Visual Basic

Many developers wish there was a language that was easy to write, read, and maintain like Visual Basic, but that still provided the power and flexibility of C++. For those developers, the new C# language is here. Microsoft has built C# with type-safety, garbage collection, simplified type declarations, versioning and scalability support, and lots of other features that make developing solutions faster and easier, especially for COM+ and Web Services. This article gives you a first look at C#, a language you are going to be hearing lots more about in the very near future.

C++ vs. C# - a Checklist from a C++ Programmers Point of View

And so, without any further ado and very brief, here is my list of differences between the two, sorted into three categories: things I like better in C#, things I like better in C++ and things where I could not make up my mind.

10 Things C++ Developers Learning C# Should Know

This article does not describe all the differences and even skips some obvious ones (single vs. multiple inheritance for example), nor are these necessarily the most important, it's just a set of 10 I've been thinking about, and more articles may follow if people find these useful.

Nick Martyshchenko