12
Answers

Static Extension Method using Func and Lambda

S

S

11y
2.2k
1
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)
Next Recommended Forum