Something like this:
var myObject = new MyClass()
{
x = \" \".Select(y =>
{
//Do stuff..
if (2 + 2 == 5)
return \"I like c
Maybe not quite answering the question but ... one reason I wanted IIFE in C# was to give better meaning to a function being called on an object. In this example I wanted to give meaning as to what the 'Click' method does in a particular context within test code (and I do not like comments).
Before ...
lastLine.Click(); //click to begin editing line
After ...
Action clickToStartEditing = line => line.Click();
clickToStartEditing(lastLine);
Later I discovered I could simply create a new method with another name ...
Action clickToStartEditing = lastLine.Click;
clickToStartEditing(lastLine);
Finally simply naming the variable in a better way can better solve the issue (for me)
lastLineForEditing.Click();
This solved an IIFE issue for me, to give meaning to the method name.