What does () => mean in C#?

前端 未结 6 1324
再見小時候
再見小時候 2020-12-06 06:20

I\'ve been reading through the source code for Moq and I came across the following unit test:

Assert.Throws(() => Times         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 07:20

    () => Times.AtLeast(0)
    

    () indicates that the lambda function has no parameters or return value.

    => indicates that a block of code is to follow.

    Times.AtLeast(0) calls the Times class's static method AtLeast with a parameter of 0.

提交回复
热议问题