title: delegate for predicate not working
body: <p>I am leaning the delagate and lambda expression. I wrote some test code, that use Count(), some of calls work, but last not working, I don't know why. Please help me with explanation. thank you.</p>
  
  <pre><code>public static int Count&lt;T&gt;(T[] arr, Predicate&lt;T&gt; condition)
  {
      int counter = 0;
      for (int i = 0; i &lt; arr.Length; i++)
          if (condition(arr[i]))
              counter++;
      return counter;
  }
  
  delegate Boolean IsOdds&lt;T&gt;(T x);
  delegate bool IsEven(int x);
  
  private void button1_Click(object sender, EventArgs e)
  {
      IsOdds&lt;int&gt; isOdds = i =&gt; i % 2 == 1;//must be &lt;int&gt;, not &lt;T&gt;
      IsEven isEven = i =&gt; i % 2 == 0;            
  
      Action&lt;int&gt; a = x =&gt; this.Text = (x*3).ToString();
      a(3);
  
      Predicate&lt;int&gt; f = delegate(int x) { return x % 2 == 1; };
      Predicate&lt;int&gt; ff = x =&gt; x % 2 == 1;
  
      MessageBox.Show("lambada " + Count&lt;int&gt;(new int[] { 1, 2, 3, 4, 5 }, x =&gt; x % 2 == 1).ToString());
      MessageBox.Show("f " + Count&lt;int&gt;(new int[] { 1, 2, 3, 4, 5 }, f).ToString());
      MessageBox.Show("ff " + Count&lt;int&gt;(new int[] { 1, 2, 3, 4, 5 }, ff).ToString());
      MessageBox.Show("delegate " + Count&lt;int&gt;(new int[] { 1, 2, 3, 4, 5 }, delegate(int x) { return x % 2 == 1; }).ToString());
      MessageBox.Show(Count&lt;int&gt;(new int[] { 1, 2, 3, 4, 5 }, isOdds(int x)).ToString());  //this is wrong
      MessageBox.Show(Count&lt;int&gt;(new int[] { 1, 2, 3, 4, 5 }, isEven(int x)).ToString());  //this is wrong
      return;
  }
  </code></pre>