title: Why this multicast delegation isn’t working with functions in C#?
body: <p>I'm a newbie in C# and exercising multicast delegation, I wrote this code:</p>
  <pre><code>class MyClass
  {
      public static double Calculate(int x, double z)
      {
          double Result = (x / z);
          return Result;
      }
  
      public static double Calculate2(int x, double z)
      {
          double Result = (x * z);
          return Result;
      }
  }
  
  public class Program
  {
      public delegate double MyDlgt(int Number1, double Number2);
  
      public static void Main()
      {
          Console.WriteLine(&quot;What is You First Value ? &quot;);
          int NUM1 = int.Parse(Console.ReadLine());
          Console.WriteLine(&quot;What is You Second Value ? &quot;);
          Double NUM2 = Double.Parse(Console.ReadLine());
  
          MyDlgt FirstDlgt = new MyDlgt(MyClass.Calculate);
          MyDlgt SecondDlgt = new MyDlgt(MyClass.Calculate2);
  
          Console.WriteLine(&quot;&lt;---------Simple Delegate ---------&gt;&quot;);
  
          Console.WriteLine(&quot;The Division Result is : &quot; + FirstDlgt(NUM1, NUM2));
          Console.WriteLine(&quot;The Multiply Result is : &quot; + SecondDlgt(NUM1, NUM2));
  
          Console.WriteLine(&quot;&quot;);
          Console.WriteLine(&quot;&lt;---------MultiCast Delegate ---------&gt;&quot;);
          MyDlgt MultiCast = FirstDlgt + SecondDlgt;
          Console.WriteLine(&quot;The Result is : &quot; + MultiCast(NUM1, NUM2));
          Console.Read();
      }
  }
  </code></pre>
  <p>The multicast is only showing the second function I don't know why.</p>
  <p>The result is</p>
  <pre><code>What is You First Value ? 
  10
  What is You Second Value ? 
  20
  &lt;---------Simple Delegate ---------&gt;
  The Division Result is : 0.5
  The Multiply Result is : 200
  
  &lt;---------MultiCast Delegate ---------&gt;
  The Result is : 200
  </code></pre>
  <p>I tried multicast with void and working perfectly</p>
  <pre><code>class MyClass
  {
          public static void Calculate(int x, double z)
          {
              Console.WriteLine(&quot;The Result is :&quot;+ (x / z));
          }
  
          public static void Calculate2(int x, double z)
          {
              Console.WriteLine(&quot;The Result is :&quot; + (x * z));
          }
  
          public static void Main()
          {
              Console.WriteLine(&quot;What is You First Value ? &quot;);
              int NUM1 = int.Parse(Console.ReadLine());
              Console.WriteLine(&quot;What is You Second Value ? &quot;);
              Double NUM2 = Double.Parse(Console.ReadLine());
  
              MyDlgt FirstDlgt = new MyDlgt(MyClass.Calculate);
              MyDlgt SecondDlgt = new MyDlgt(MyClass.Calculate2);
             
              Console.WriteLine(&quot;&lt;---------Simple Delegate ---------&gt;&quot;);
             
              FirstDlgt.Invoke(NUM1, NUM2);
              SecondDlgt.Invoke(NUM1, NUM2);
              
              Console.WriteLine(&quot;&quot;);
              Console.WriteLine(&quot;&lt;---------MultiCast Delegate ---------&gt;&quot;);
              MyDlgt MultiCast = FirstDlgt + SecondDlgt;
                       
              MultiCast(NUM1, NUM2);
              Console.ReadLine();
          }
      }
  }
  </code></pre>
  <p>The result is correct :</p>
  <pre><code>What is You First Value ? 
  10
  What is You Second Value ? 
  20
  &lt;---------Simple Delegate ---------&gt;
  The Result is :0.5
  The Result is :200
  
  &lt;---------MultiCast Delegate ---------&gt;
  The Result is :0.5
  The Result is :200
  </code></pre>
  <p>Why it is working with void and not with functions with return ?</p>
  <p>Sorry for the long post, thanks in advance</p>