Why was Func<T, TResult>(开发者_如何学C..) 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.
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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论