C# 6.0 New Features: Methods with Expression Body

Since its release, C# has travelled a long journey from being a imperative language to a declarative one. With this journey the way we use to write methods have also changed a lot. Lets try to understand the journey of a method from C# 1.0 to 6.0
This is how we use to write methods in C# 1.0 .These were called named methods.Also you can see how a delegate is using a named method to print a value to console.

Continue reading

C# 6.0 New Features : Importing Static classes via USING keyword

Static in C#:
Static is a compiler reserved keyword in C#, which can be applied to any member of a class i.e. well Fields, methods, classes, Properties, Events or to a class itself as well.
There will be only one copy of a member variable declared as static. Each object has its own copy of instance variables whereas static variables are shared across objects.

Continue reading

C# 6.0 New Features: Async in Catch and Finally Blocks

The most common programming practice is to catch exceptions and log them. Logging involves IO since we usually log into files or database. IO operations are usually expensive in terms of performance which means that in a serviced kind of environment, the end user who is waiting for a response is actually being kept waiting for logging messages as well.

Continue reading