Meaning of () => Operator in C#, if it exists

前端 未结 5 1080
余生分开走
余生分开走 2020-12-07 22:30

I read this interesting line here, in an answer by Jon Skeet.

The interesting line is this, where he advocated using a delegate:

Log.Info(\"I did som         


        
5条回答
  •  太阳男子
    2020-12-07 23:19

    It's way to pass anonymous delegate without parameters as lambda expression.

    Similar to this from .NET 2.0

    Log.Info("I did something: {0}", delegate()
                {
                    return action.GenerateDescription();
                });
    

提交回复
热议问题