You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Revised from #249 I have another way we could implement anonymous inline local function syntax
I think we should be able to write lambda function like a member of object like this
varlongNameObj=newSomeObject().(obj)=>{// obj is the object from new SomeObject()if(condition)returnobj;// some long logicobj.IntProperty=resultOfLogic;};varvalue=longNameObj.IntProperty.(v)=>(v+(v*random.Next()))/2;// instead of `longNameObj.IntProperty + (longNameObj.IntProperty * random.Next())) / 2`
This let us can have scope variable for long named property. Ability to write shortcut return logic. And speed of inline function
Alternatively I was using extension method to make a lambda function for the same purpose. But it lose the performance because it is the real lambda function
This discussion was converted from issue #888 on September 08, 2020 21:47.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Revised from #249 I have another way we could implement anonymous inline local function syntax
I think we should be able to write lambda function like a member of object like this
This let us can have scope variable for long named property. Ability to write shortcut return logic. And speed of inline function
Alternatively I was using extension method to make a lambda function for the same purpose. But it lose the performance because it is the real lambda function
Also this syntax make us can write a chained block like linq. Actually my idea came from linq syntax for one object
Beta Was this translation helpful? Give feedback.
All reactions