Worksheets104-P-01: Delegates and lambdas
Total questions: 10
Worksheet time: 14mins
Delegates, what is it?
Lambdas, what is it?
What types of delegates are pre-defined in C#?
Actions
Predicates
Comparisons
Functions
How to create a lambda that takes 2 arguments?
(x, y) -> x + y
(x, y) => x + y
(x, y) => { x + y; }
(x, y) => { return x + y; }
Select the correct information about this `Func` delegate
It returns a char
It returns an int
It returns nothing
It returns a tuple (int, double, string, char)
Select the correct information about this `Func` delegate
It takes 3 parameters
It takes 4 parameters
It takes 0 parameter
It takes only a tuple as parameter
Are ACDC greater, lower or equal to YAKA?
Greater
Lower
Equal
Does this code compile?
YES!
NO!
Declare a delegate named `MyAwsomeDelegate` that takes an `int` and a `double` and returns nothing.
How many parameters can have a `Func`, at most?
16, because why not? 🤔
There is no limit, because nobody can limit our power! 😈
5, it's already enough
The answer D, always and forever
6, for optimization reasons
