-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Selector expressions #596
Comments
I am also thinking of dropping the Dim stdunetsNames= Students[#Grade > 3].
Select(Function(x) New with {x.Name, x.Grade})' Which will be mush better if rewritten as: Dim stdunetsNames= Students[#Grade > 3].Select(#Name, #Grade)' And this is where we van rethink of LinQ syntax as: Dim stdunetsNames= Students Where #Grade > 3
Select #Name, #Grade |
As a special case, |
Ummm. Because, in both cases, It looks like you meant |
My bad :) |
Suppose we have an array named arr, and want to select items > 3:
I want to rewrite it like this:
Note:
In #556, I asked for allowing [] for arrays and indexer. I am using this here to avoid any confusion with any old code using
()
.It items are objects with properties:
then:
Which can be shorten to:
note that I previously wanted to use dot instead of #, but this can cause some confusion inside With Blocks.
Now, Suppose we have a list like this:
lets complicate the selector a little:
or with LinQ:
We can make this shorter by defining a var for the selector and reuse it:
Note using the type #Student so we avoid late binding and have intellisense support.
which can be more compact if VB always the in array syntax:
or in another way (since the selector is an expression tree, if can be some sort of a function delegate expression:
and if add a StartsWithAny extension method to the string class:
The text was updated successfully, but these errors were encountered: