public class Program
{
delegate string Collection(int a, int b);
public void Main()
// Collection c; // No methods attached to c
// c = Multiply; // Multiply attached to c
// c += Subtract; // Multiply, Subtract attached to c
// c -= Multiply; // Subtract attached to c
Collection a = Multiply; // Multiply method attached to a
a += Subtract; // Multiply, Subtract methods attached to a
Collection b = Divide; // Divide method attached to b
Collection c = a + b; // Multiply, Subtract, Divide methods attached to c
}
string Multiply(int x, int y)
return (x * y).ToString();
string Subtract(int x, int y)
return (x - y).ToString();
string Divide(int x, int y)
return (x / y).ToString();