I wonder why this syntax is not allowed in c#?
var email = (User user = User.Current) != null ? user.Email : "default@mail.com";
When this is allowed:
User user;
var email = (user = User.Current) != null ? user.Email : "default@mail.com";
Why does the variable have to be defined already, and cannot be defined in the statement?
This would help to make lines shorter, for example:
var email = User.Current.Very.Complex.Path != null ? User.Current.Very.Complex.Path.Email : "default@mail.com";
could be
var email = (var user = User.Current.Very.Complex.Path) != null ? user.Email : "default@mail.com";