Allow _.Property shorthand for lambda functions #7607
-
This is a feature that is coming in the next F# release fsharp/fslang-suggestions#506 that I believe would be great to have in C# It's very usual to have The idea is to have a syntax sugar for this kind of common definition. Probably replacing LINQ example: using System.Linq;
Person[] persons = [];
// normal
var result1 = persons.Select(p => p.Name).GroupBy(p => p.Length);
// propose _
var result2 = persons.Select(_.Name).GroupBy(_.Length);
// propose just "."
var result3 = persons.Select(.Name).GroupBy(.Length);
record Person(string Name); |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
While I like F# I really feel like using Even Also don't forget that in F# you have to write let result1 = persons.Select(fun p -> p.Name).GroupBy(fun p -> p.Length) var result1 = persons.Select(p => p.Name).GroupBy(p => p.Length); |
Beta Was this translation helpful? Give feedback.
-
See: #91 |
Beta Was this translation helpful? Give feedback.
-
This is not needed in anyway. |
Beta Was this translation helpful? Give feedback.
See: #91