C# – What are the best resources to learn writing idiomatic c#?

.netc++idioms

I am looking for something like idiomatic ruby for c# programmers

It should:

  • be for people that can already programm

  • be terse

  • not be to basic

just found a better thread for this question on stackoverflow: c-coding-standard-best-practices

Best Solution

You might want to try Effective C# and More Effective C#, both by Bill Wagner.

I haven't read either of them properly (must get round to doing so some time) but I've heard good things.

Assuming you're using C# 3, I would try to make sure you're familiar with:

  • Generics and what type inference on generic methods can do with you
  • IEnumerable<T> and iterator blocks
  • LINQ in general, and LINQ to Objects in particular (other LINQ flavours are useful in some places - LINQ to Objects is useful almost everywhere)
  • Delegates, particularly lambda expressions and anonymous methods
  • Object and collection initializers
  • Extension methods - be aware of them, and consider them for utility methods. In particular they're handy if you want to add your own LINQ operators