4 ms·
Sure for new code, but I think the concession here is that it provides convenience for dealing with existing code/libraries. Additionally, it allows restrictin
by hermitdev 10y ago
Sure for new code, but I think the concession here is that it provides convenience for dealing with existing code/libraries.
Additionally, it allows restricting the scope of the variable, like in the TryParse examples. The output variable in something like "if (int.TryParse(someString, out var i))" is now scoped to the if block. It cannot be used in the else, nor inadvertently later in the parent scope.