Q:

Lambda expression - How to work on delegates in C#?

I took the following example from Jrista's answer to a post.
Finding Twentyone count
int[] numbers = new[] { 1, 3, 11, 21, 9, 23, 7, 4, 18, 7, 7, 3, 21 };

var twentyoneCount = numbers.Where(n => n == 21).Count();

  Suppose i use "Func" delegate how can i get the count ?  
I tried as (pardon me for the bad syntax)

var otherway= Func  <int> numbers= x => x==21;

A:

You are using an anonymous delegate with the same signature as Func<int, bool> right now. If you wanted to use a method instead, you could write:
// a method that takes int and returns bool is
// a Func<int, bool> delegate
public bool IsEqualTo21(int x)
{ 
    return (x == 21);
}

And then use it as:
var twentyoneCount = numbers.Where(IsEqualTo21).Count();

