The this
keyword for lambda
#4946
-
SummaryI would like to suggest adding the ability to allow users.Where(this => Age < 35).ToList(); Usage example with ReactiveUI DataBinding: this.WhenActivated(this =>
{
this.Bind(ViewModel, this => TheText, this => TheTextBox.Text)
.DisposeWith(this);
this.OneWayBind(ViewModel, this => TheText, this => TheTextBlock.Text)
.DisposeWith(this);
this.BindCommand(ViewModel, this => TheTextCommand, this => TheTextButton)
.DisposeWith(this);
}); MotivationI would like to reduce the amount of writing the same parameter. DrawbacksThe main problem is the conflict with the class the lambda is in. I suggest if the variable, method, etc. in the class is called the same as in the lambda parameter object and we need to access the variable from the class, then we use this syntax By default, in such a conflict, the variable from the lambda parameter is used. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
An alternative approach to reduce writing a parameter that is even shorter: #91 |
Beta Was this translation helpful? Give feedback.
-
Also see #1151 where I think replacing "this" makes more sense. |
Beta Was this translation helpful? Give feedback.
Also see #1151 where I think replacing "this" makes more sense.