Proposal: Introducing the LINQ 'derive' Keyword #7617
Unanswered
sangeethnandakumar
asked this question in
Language Ideas
Replies: 2 comments 1 reply
-
Personally, I don't see a reason to have a LINQ-specific |
Beta Was this translation helpful? Give feedback.
1 reply
-
Ya the only limitation I see is |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
LINQ Projection
In LINQ, projection is a common operation where we shape the output of a query to meet specific requirements. Typically, we use the select clause to create new objects with the desired properties. Here's an example:
Potential Improvement Area
select
approach just projects the instance or allow us to create new instanceThe Need for Data Mutation in Projections
What if we could seamlessly mutate specific properties during the projection without specifying all properties explicitly?
Introducing the
derive
KeywordI'm proposing the introduction of a new LINQ keyword,
derive
to enable data mutation during projections. The derive keyword is designed to enhance the expressiveness and efficiency of LINQ. Here's how it works:In this example, we use the
derive
keyword to modify the TotalAmount property of the customer object.This enhancement allows us to mutate data while preserving all other properties, eliminating the need to repeat them in the projection.
The introduction of the derive keyword not only streamlines LINQ queries but also provides a clear signal to code analyzers that data mutation is occurring.
I believe that the
derive
keyword is a valuable addition to LINQ, simplifying data manipulation, improving code clarity, and enhancing the overall development experience.I personally felt this was a required feature. Here are some people also faced similar ones. All answers seems some sort of workarounds
and more...
Beta Was this translation helpful? Give feedback.
All reactions