I’ve had the pleasure of working with and interviewing C# developers for over a decade now. However here’s 5 common misconceptions I continue to encounter.
1) Lists are implemented as linked lists
List<T> is actually implemented using an underlying array. The name is a little misleading with the earlier non-generic version having the less ambiguous name of ArrayList and in F# they are aliased to ResizeArray to avoid confusion. Needless to say the performance characteristics of operations on an array are somewhat different to those of a linked list.
2) var is dynamic
The var keyword is used to implicitly define a local variable that is strongly typed using type inference.There is actually no runtime difference from explicitly defining the type.
3) Dependency injection requires interfaces
Dependency injection has become common practice in C# code bases. Many seem to believe that you can only inject interfaces, often leading to interface proliferation, to the point that it can feel like you’re back in C++ land with header files. In fact most dependency injection environments support injection of abstract and even concrete classes.
4) Built-in serialization is efficient
The truth is the opposite, it is slow and verbose. If you’re looking for something efficient consider using Google Protocol Buffers with a library like protobuf-net or JSON from a third party like Service Stack.
5) C# is at the cutting edge of programming language design
C# is heavily based on the Java programming language, and has since made some incremental improvements like LINQ and more recently the async/await keywords. The reality is that all of the “new” features in C# are actually rather old, and progress has been pretty slow when compared to more recent curly brace languages like Scala and Nemerle.
Iterators introduced in C# in 2005 are merely coroutines, defined in 1963, they were first seen in the 1970s in Modula-2.
LINQ provides a library of higher order functions available as extension methods. Similar libraries have been available in functional programming languages like ML since the 70s, for example Select is equivalent to List.map and Where is equivalent to List.filter.
Finally C#’s innovative new async feature actually first appeared in F# back in 2007.
Maybe the pace will pick up when Roslyn is finally delivered, but if you want to experience a wider range of features you might want to look at Clojure, F#, Nemerle, Scala or TypeScript.