Complete the code to create a lambda that adds a captured variable to its input.
int addValue = 5; Func<int, int> add = x => x [1] addValue; int result = add(3);
The lambda adds the captured variable addValue to the input x using the + operator.
Complete the code to capture a variable and use it inside the lambda to multiply the input.
int multiplier = 4; Func<int, int> multiply = n => n [1] multiplier; int output = multiply(2);
The lambda multiplies the input n by the captured variable multiplier using the * operator.
Fix the error in the lambda expression to correctly capture the variable and add it to the input.
int offset = 10; Func<int, int> addOffset = (int x) => x [1] offset; int result = addOffset(5);
The lambda should add the captured variable offset to the input x using the + operator.
Fill the blank to create a lambda that captures a variable and returns true if input is greater than that variable.
int threshold = 7; Func<int, bool> isGreater = x => x [1] threshold; bool check = isGreater(10);
The lambda compares if x is greater than the captured threshold using the > operator.
Fill all three blanks to create a lambda that captures a string and returns it repeated n times.
string word = "Hi"; Func<int, string> repeat = n => string.Concat(Enumerable.Repeat([1], [2])); string result = repeat([3]);
The lambda uses the captured variable word and repeats it n times. The call uses 3 to repeat it three times.