News for hackers. Stuff that matters.
Re:More functional C# by Touche on Monday January 13, 2014 @08:50AM (#7050494)
> Do you have any examples?

Sure, write a self-executing function in C#.

Re:More functional C# by paulmcpazzi on Monday January 13, 2014 @09:12AM (#7050604)

  ((Action)(() => Console.WriteLine("Hello")))();
or

  new Action(() => Console.WriteLine("Hello"))();
Yeah, it's verbose because you have to cast the lambda expression before executing it, but honestly I don't know any case where a self executing function can be useful in C#.
Re:More functional C# by Touche on Monday January 13, 2014 @10:23AM (#7051032)
Not too bad. Actions return null though. How about a self-executing function that returns a value? This is useful for assigning values to variables. IIRC it's going to start getting more ugly from here.
Re:More functional C# by noblethrasher on Monday January 13, 2014 @10:45AM (#7051183)

    (new Func<int>(() => 2))();