title: what is the need of delegates?
body: <p>Iam not sure whether anyone ask the same question. But i couldnt find out any sources which are relevant for my doubt. </p>
  
  <p>what is the need of delegates in real time programming? there are lot of steps needs to be done to implement it.</p>
  
  <pre><code>public delegate void SimpleDelegate();
    class TestDelegate
      {
          public static void MyFunc()
          {
              Console.WriteLine("I was called by delegate ...");
          }
          public static void Main()
          {
              // Instantiation
              SimpleDelegate simpleDelegate = new SimpleDelegate(MyFunc);
  
              // Invocation
              simpleDelegate();
          }
      }
  </code></pre>
  
  <p>If re usability is a main reason (since no need to create instance) for using delegate, this can be achieved by other ways also. or this is the only advantages of using delegates? I know anonymous method do a better way than delegate. But is it providing anything than delegates other than simplification of steps. and how i can reuse anonymous method when the structure will be something like given below.</p>
  
  <pre><code>List&lt;int&gt; values = new List&lt;int&gt;() { 1, 1, 1, 2, 3 };
  List&lt;int&gt; res = values.FindAll(delegate(int element)
      {
          if (element &gt; 10)
          {
          throw new ArgumentException("element");
          }
          if (element == 8)
          {
          throw new ArgumentException("element");
          }
          return element &gt; 1;
      });
  </code></pre>
  
  <p>I am confused. Please shed some lights on this.</p>