title: Using C# Count() with a function
body: <p>I'm trying to figure out how many times the <strong>maximum value</strong> of an array occurs within the array by using Linq's<a href="http://msdn.microsoft.com/en-us/library/bb535181.aspx" rel="nofollow noreferrer"><code>.Count()</code></a> with a predicate inside. However, I don't fully understand how to do it. From reading the MSDN's scant example I thought I understood, but apparently not!</p>
  
  <p>This is what I thought of:</p>
  
  <pre><code>string[] test = { "1", "2", "3", "4", "4" };
  string max = test.Max();
  Label1.Text = test.Count(p =&gt; p == max);
  </code></pre>
  
  <p>But that did not work. So I tried changing <strong>max</strong> to an integer to see if that would work, but that did not work either.</p>