Is there a practical difference between .All() and .TrueForAll() when operating on a List? I know that .All() is part of IEnumerable, so why add .TrueForAll()?
From the docs for List<T>.TrueForAll:
Supported in: 4, 3.5, 3.0, 2.0
So it was added before Enumerable.All.
The same is true for a bunch of other List<T> methods which work in a similar way to their LINQ counterparts. Note that ConvertAll is somewhat different, in that it has the advantage of knowing that it's working on a List<T> and creating a List<TResult>, so it gets to preallocate whatever it needs.
TrueForAll existed in .NET 2.0, before LINQ was in .NET 3.5.
See: http://msdn.microsoft.com/en-us/library/kdxe4x4w(v=VS.80).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With