title: Using a Multicast Delegate to chain functions
body: <p>My question is detailed in the following code - the reason I'm asking this is that I'm experimenting with delegates:</p>
  
  <pre><code>//create the delegate          
  delegate int del(int x);
  
  class Program {
  
  
      static void Main(string[] args) {
  
          Program p;
          p = new Program();
  
          del d = p.a;
          d += p.b;
          d += p.c;
          d += p.d;
          d += p.e;
          Console.WriteLine(d(10)); //&lt;&lt;was hoping it would be 10+2+3+4+5+6
  
          Console.WriteLine("press [enter] to exit");
          Console.ReadLine();
      }
  
      private int a(int x) { Console.WriteLine("a is called"); return x + 2; }
      private int b(int x) { Console.WriteLine("b is called"); return x + 3; }
      private int c(int x) { Console.WriteLine("c is called"); return x + 4; }
      private int d(int x) { Console.WriteLine("d is called"); return x + 5; }
      private int e(int x) { Console.WriteLine("e is called"); return x + 6; }
  
  } 
  </code></pre>
  
  <p>16 is returned....</p>
  
  <p><img src="https://i.stack.imgur.com/vmBAR.png" alt="enter image description here"></p>
  
  <p>All the functions fire, as the various messages "a is called" etc all get printed to the <code>console</code> but only the amount returned from the last function <code>e</code> is returned - I'm assuming in the background they are getting returned but then overwritten?</p>