Practice mode C#

Which built-in delegate type should represent a method that takes a string and returns nothing?

Correct answer B. Action<string>

Explanation

Action delegates represent methods that return void, so Action takes one string and returns nothing. Func takes no parameters and returns a string. Predicate returns a bool. Func is invalid because void cannot be used as a type argument. Lambdas such as s => Console.WriteLine(s) convert to Action.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.