Test Your Knowledge: Quiz
Question 17-1. What is the purpose of a delegate?
Question 17-2. Are delegates value types or reference types?
Question 17-3. Suppose a Phone
class has defined an OnPhoneRings
delegate. How would you instantiate a delegate called myDelegate
to refer to the myMethod
method?
Question 17-4. Define the OnPhoneRings
delegate from the preceding question as an event to signal that the phone has rung.
Question 17-5. Give an example of how you might call the delegated method from the previous question through the delegate.
Question 17-6. What does the event
keyword do?
Question 17-7. How do you pass information into the method that is called through the event?
Question 17-8. What properties or methods does System.EventArgs
have?
Question 17-9. How can you create delegated methods anonymously?
Question 17-10. What is returned by a lambda expression?
Get Learning C# 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.