I'm a very new to C#. Just playing around with it. Not for a real purpose.
void makeOutput( int _param)
{
Console.WriteLine( _param.ToString());
}
//...
// Somewhere in a code
{
makeOutput( /* some not c# code for an example for what do I want */ function : int () { return 0; } );
}
Is it possible to use a REAL anonymous functions (means returning result)?
I do not want to use delegates such as
// Somewhere in a code
{
Func<int> x = () => { return 0; };
makeOutput( x())
}
Also I DO NOT want to change method parameter type such as
void makeOutput( Func<int> _param)
{
}
That is very common decision.
Everything is alright. I just understood that I wanted impossible things. I wanted to declare anonymous function and execute it in the same place. Note: DIRECT declaring and DIRECT call without generic wrapper.
// flash-like (as3) code /// DOES NOT COMPILE
makeOutput( (function : int(){ return 0; })() );