Review Questions

1:What are the similarities and differences between delegates and abstract methods?
2:Why is delegate a good name for the delegate construct?
3:Where in a program can a delegate definition be positioned?
4:Consider the following delegate definition:
public delegate int Filtering(string str);

Which of the following methods can instances of this delegate encapsulate?

  1. protected int Filtering(string myString, double x) {...}

  2. internal static int FilteringOp(string myStr) {...}

  3. public double Filtering(string str) {...}

  4. public short Sum(int x, int y) {...}

5:Why must multicast delegates have the return type void?
6:
  1. Which arithmetic operators can be used with multicast delegates?

  2. Which arithmetic operators can be used with events when called ...

Get C# Primer Plus 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.