passing Func<TSource, TKey> keySelector error
- by user338429
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?