Collection Expressions: Eliminate [ ] when used with Single-item collection #8053
Replies: 3 comments 4 replies
-
That's already a legal expression, a LINQ query that produces an A single-item collection is still a collection, to me the |
Beta Was this translation helpful? Give feedback.
-
What is it about today's syntax that looks subjectively worse? Not that this is "the way" or anything, but this is how I've been formatting code like that: var ret = new MultiResponseJson<AlertJson>
{
Data = [..
from x in Json
let v = new ResponseJson<AlertJson> { Data = x }
select v],
}; Since I place |
Beta Was this translation helpful? Give feedback.
-
The auto conversion of singleton collection is my least favor behavior of PowerShell. Element and collection are different order of types. |
Beta Was this translation helpful? Give feedback.
-
This morning I wrote this code:
And I thought it would look better if I could eliminate the
[ ]
from collection expressions that contain a single...
item.ie:
Beta Was this translation helpful? Give feedback.
All reactions