Lambda\Anonymous Function as a parameter

前端 未结 3 744
我在风中等你
我在风中等你 2021-01-04 05:44

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());
}

//..         


        
3条回答
  •  萌比男神i
    2021-01-04 06:35

    void makeOutput(Func _param)
    {
        makeOutput(_param());
    }
    
    void makeOutput(int _param)
    {
        Console.WriteLine( _param.ToString());
    }
    

    This can do the trick!
    It's the simples way : overloading!

提交回复
热议问题