C# 6.0 Features
string interpolation - It is mainly introduced to remove string. Format. It is a new way of concatenating strings, manipulating strings and formatting strings
Null conditional operator - this is used to avoid nullreference exception like object reference not set to an instance of an object. When we use this operator : it returns null as a value and wont throw any exception.
Expression-body-function : This is nothing but similar to writing normal code inside methods only this here we dont use "RETURN" keyword to return anything. Here we need to use lamba operator and dont not use "RETURN" keyword inside lamba operator expression.This is nothng but a shortcut implementation of the method thats it.
nameOf - Sometimes we need to print the name of declared variables as it is then we use "nameof"
exception-filter : This means that now we can decide whether catch block should be executed or not based on boolen expression given immdieatley after catch block
async and await in catch block - This is similar to asyn and await functionality. Instead of giving async it in try block, we are giving it in catch block. This functionality is added for catch block also becuase if there is logging mechanism that takes long time to log the errors then without asyn, the main thread should untill the catch block completes and main thread will freeze at this time. Hence we need async in catch and final block.
Comments
Post a Comment