In C#7 we can write this:
var a = 1 < 2 ? "true" : throw new Exception();
why can't we to do rethrowing? For example:
try
{
var er = 1/0;
}
catch (Exception ex)
{
var a = ex.InnerException == null ? ex.Message : throw;
}
As far as my understanding of standart using try-catch-throw
, there is some «context» (contains throwed exception) in the try-catch
block passed into throw
as non-obviously argument. Isn't it?
The same question with the null-coalescing operator - ??
.