Before C# 7.0 it was not possible to throw an exception directly in expression-bodied members. The workaround was to call a method that throws an exception.
It’s time to sum up all C# 6 features. Here is a list of all goodness with short examples implemented and tested in Visual Studio 2015. nameof String interpolation Null-conditional (?. and ?) and null-coalescing (??) operators Index initializers Extension methods visible in collection initializers Exception filters Auto-property initializers Expression-bodied […]
Don’t you have a feeling that sometimes C# code goes too much in null-checking? Yep, me too. But there are few C# 6 null-conditional operators that change it for good.