Guest User

Guest User

  • Tech Writer
  • 357
  • 118.2k

Static Extension Method using Func and Lambda

Mar 28 2013 4:53 PM
Given the following:-
public static string CommaSeparate<T, U>(this IEnumerable<T> source, Func<T, U> func) {     return string.Join(",", source.Select(s => func(s).ToString()).ToArray()); }

I appreciate that a Lambda expression matches a Func delegate in terms of Input maps to Output.

So why does the Lambda in the Select method show s => func(s).ToString(); rather than s => s.ToString();

Thanks

Answers (12)