passing Func<TSource, TKey> keySelector error

Posted by user338429 on Stack Overflow See other posts from Stack Overflow or by user338429
Published on 2010-05-11T15:32:14Z Indexed on 2010/05/11 15:34 UTC
Read the original article Hit count: 168

Filed under:
|
|
|
|
static void Main()
        {
string[] a = { "a", "asd", "bdfsd", "we" };
            a = a.OrderBy(fun).ToArray();
}

 private static int fun(string s)
        {
            return s.Length;
        }

its is giving compile time error . I know that we can do this with Lambda expression like this. a.OrderBy(s=>s.Length).ToArray(); but i want to this do by defining different function . What mistake i have done?

© Stack Overflow or respective owner

Related posts about c#3.0

Related posts about c#