tags:

views:

125

answers:

1

Why was Func<T, TResult>(..) introduced with .NET 3.0 whereas Action<T>(..) with .NET 2.0?

Edit: I'm coding a project in .NET 2.0 right now and am missing Func. Although it's easy to roll your own as mentioned in the comments and answers i.e. simple delegate TResult Func<T,TResult>(T); I am curious why the timing would be different with two items so similar in nature.

+1  A: 

Action<T> and Predicate<T> were probably added because of the methods on List<T>. It wasn't until C# 3.5 that lambdas were introduced and general delegates like these were particularly convenient.

But as John mentioned, just create your own. There's nothing special about those delegates.

Josh Einstein
Seems reasonable.
John K