So I currently have the following code:
BCLThread bclThread = new BCLThread(() => Thread.Sleep(0));
because I can't think of another way to state that I actually don't want that method to do a thing. Is there any other more elegant way of achieving this?
Thanks
In lambda expressions, the lambda operator => separates the input parameters on the left side from the lambda body on the right side.
Lambda functions are intended as a shorthand for defining functions that can come in handy to write concise code without wasting multiple lines defining a function. They are also known as anonymous functions, since they do not have a name unless assigned one.
Lambda expressions in C# are used like anonymous functions, with the difference that in Lambda expressions you don't need to specify the type of the value that you input thus making it more flexible to use. The '=>' is the lambda operator which is used in all lambda expressions.
Why not
BCLThread bclThread = new BCLThread(() => {});
?
Action a = delegate { };
Action b = () => { };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With