Delegates & events interview questions
Func, Action, multicast delegates, events, closures.
3 questions with answers and explanations · 2 flashcards
Key ideas
- A delegate is a type-safe reference to a method.
Func<..., TResult>returns a value;Action<...>doesn't;Predicate<T>returns bool. - Delegates are multicast:
+=adds to the invocation list. - An
eventrestricts outside code to+=/-=. Only the declaring class can raise it. - Lambdas capture variables, not values. A
forloop variable is shared across iterations.