Well, that would depend entirely on what code is in the MageAggregateGoFaster namespace now wouldn't it?
This namespace is not part of the .NET runtime, so you've linked in some custom code.
Personally I would think that something that recognizes string concatenation or similar, and builds up a list, or similar, then allocates one big StringBuilder and uses Append.
A dirty solution would be:
namespace MakeAggregateGoFaster
{
public static class Extensions
{
public static String Aggregate(this IEnumerable<String> source, Func<String, String, String> fn)
{
StringBuilder sb = new StringBuilder();
foreach (String s in source)
{
if (sb.Length > 0)
sb.Append(", ");
sb.Append(s);
}
return sb.ToString();
}
}
}
dirty because this code, while doing what you say you experience with your program, does not use the function delegate at all. It will, however, bring down the execution time from around 2800ms to 11ms on my computer, and still produce the same results.
Now, next time, perhaps you should ask a real question instead of just look how clever I am type of chest-beating?