You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's it. If the pattern-match failed, variables will be assigned to their default value, therefore, they are definitely assigned before leaving the method and no CS0177 shall be raised.
This is specifically useful with #11293 and #13401.
Note: When we are matching against the static type of a property of another property it could be simplified further using the dot operator:
I agree. With deconstruction following the out parameter route and possibly active patterns as well I think it would make for some succinct one-liners to be able to match and deconstruct directly into existing variables. As pattern variables are no longer readonly I think that the inconsistency concerns are no longer a factor.
Proposal: Bind to existing variables in patterns
Ability to assign the target expression to existing variables (rel. #8990, #9005):
We can rewrite this method in one line if we could assign the target expression to existing variables inside the pattern.
That's it. If the pattern-match failed, variables will be assigned to their
default
value, therefore, they are definitely assigned before leaving the method and noCS0177
shall be raised.This is specifically useful with #11293 and #13401.
Note: When we are matching against the static type of a property of another property it could be simplified further using the dot operator:
etc.
The text was updated successfully, but these errors were encountered: