LinqAF: Release 3.0.0Posted: 2018/06/10 Filed under: code Comments Off on LinqAF: Release 3.0.0
A new release (3.0.0) of LinqAF is now available on NuGet, and it’s got a decent amount of new stuff.
LinqAF 3.0.0 introduces the following operators:
- Append (added in .NET Framework 4.7.1)
- Prepend (likewise)
- SkipLast (added in .NET Core 2.0)
- TakeLast (likewise)
- ToHashSet (adding in .Net Framework 4.7.2)
In particular I found myself really wanting ToHashSet() when I was playing around with converting existing projects to LinqAF, practically every project seems to have a homegrown version.
IEnumerable<T> is used all over the place in .NET, and in prior versions of LinqAF you’d need to add an AsEnumerable call to call them. Even worse, some methods (like those on String) take either IEnumerable<T> or object so porting to LinqAF could introduce bugs.
Now LinqAF provides implementations, as extension methods, of the following methods that take all of LinqAF’s enumerables:
- HashSet<T>, ISet<T>, and SortedSet<T>’s
New classes have been added that provide implementations of commonly used static methods, as well as pass-throughs to the normal classes:
- LinqAFString as an alternative to System.String, providing LinqAF friendly versions of
- LinqAFTask as an alternative to System.Threading.Task, with friendly versions of
Additionally, a helper class for calling the constructors of built-in collections has been added, LinqAFNew, which provides methods equivalent to the enumerable consuming constructors of:
The biggest change is that RangeEnumerable and ReverseRangeEnumerable are no longer generic, making the performance of anything involving Enumerable.Range() considerably faster as there’s no reflection going on.
At this point LinqAF is pretty close to feature complete, I don’t think I’ll be adding many more operations. I am quite interested in increasing the performance of the current operators, while LinqAF is always lower in allocations it remains slower than LINQ-to-Objects for many cases.