C, C++, C#, Java bad practices: learn how to make a good code by bad example

10 features in C# that you really should learn (and use!)

If you start exploring C# or decide to expand your knowledge, you should learn these useful language features, which will help you to simplify the code, avoid errors and save a lot of time.

1) async / await

Use the async / await-pattern to allow unblocking of the UI / current thread when execution blocking operations. The async / await-pattern works by letting the code continue executing even if something is blocking the execution (like a web request).

7) nameof Expression – C# 6

So the new nameof-expression might not seem important, but it really has it value. When using automatic re-factoring tools (like ReSharper) you sometime need to refer to a method argument by it’s name:

yield return can be very powerful if it’s used in the correct way. It enables you to lazily generate a sequence of objects, ie. the system does not have to enumerate the whole collection – it can be done on demand.

11 thoughts on “10 features in C# that you really should learn (and use!)”

This is a good article. So many new features get added to C# that I read about them, think to myself, that is great, but then I go back to my day-to-day programming and never actually use it. Of course, this means that a week later I have completely forgot about them! 🙂