EnumerationQuest 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package EnumerationQuest --version 1.0.0
                    
NuGet\Install-Package EnumerationQuest -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EnumerationQuest" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EnumerationQuest" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="EnumerationQuest" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EnumerationQuest --version 1.0.0
                    
#r "nuget: EnumerationQuest, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EnumerationQuest@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EnumerationQuest&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=EnumerationQuest&version=1.0.0
                    
Install as a Cake Tool

EnumerationQuest

Avoids multiple enumeration.

appveyor codecov nuget

Introduction

EnumerationQuest library allows the evaluation of multiple properties of an IEnumerable in a single enumeration.

It's as simple as that:

    var (min, max) = enumerable.GetMin().AndMax();

Tell me more

EnumerationQuest provides the same methods as LINQ to Objects to evaluate properties of IEnumerable.
But unlike LINQ, EnumerationQuest allows the evaluation of several properties at once; that's it, in a single enumeration.

To achieve this, EnumerationQuest uses fluent pattern to construct an EnumerationRequests object.

  • The first method is called on the IEnumerable source object with the Get prefix.
  • The following ones are called on EnumerationRequests object with the And prefix.
  • The enumeration and the evaluations are performed at the deconstruction of the EnumerationRequests object.

Et voilà :

    var (min, avg, max, count) = e.GetMin()
                                  .AndAverage()
                                  .AndMax()
                                  .AndCount();

Available methods

  • Aggregate: applies an accumulator function over a sequence.
  • All: determines whether all elements of a sequence satisfy a condition.
  • Any: determines whether any element of a sequence exists or satisfies a condition.
  • Average: computes the average of a sequence of numeric values.
  • Contains: determines whether a sequence contains a specified element.
  • Count: returns the number of elements in a sequence; or the number of elements that satisfy a condition.
  • DelimitedString (aka String.Join): concatenates the elements of a sequence, inserting the specified separator between each element.
  • ElementAt: returns the element at a specified index in a sequence.
  • ElementsAt: returns the elements at the specified indices in a sequence.
  • ElementAtOrDefault: returns the element at a specified index in a sequence or a default value if the index is out of range.
  • First: returns the first element of a sequence; or the first element that satisfies a condition.
  • FirstOrDefault: returns the first element of a sequence; or the first element that satisfies a condition; or a default value if such an element does not exist .
  • IndexOf (from List<T> and Array): returns the zero-based index of the first occurrence of a value in a sequence.
  • IndicesOf: returns the zero-based indices of all occurrences of a value in a sequence.
  • Last: returns the last element of a sequence; or the last element that satisfies a condition.
  • LastOrDefault: returns the last element of a sequence; or the last element that satisfies a condition; or a default value if such an element does not exist .
  • LongCount: returns a long that represent the number of elements in a sequence; or the number of elements that satisfy a condition.
  • Max: returns the maximum value in a sequence of value; or a sequence of transformed values.
  • MaxBy: returns the maximum value in a sequence according to a specified key.
  • MaximumsBy: returns the maximums values in a sequence according to a specified key.
  • Min: returns the minimum value in a sequence of value; or a sequence of transformed values.
  • MinBy: returns the minimum value in a sequence according to a specified key.
  • MinimumsBy: returns the minimums value in a sequence according to a specified key.
  • SequenceEqual: determines whether two sequences are equal according to an equality comparer.
  • Single: returns the single element of a sequence; or the single element that satisfies a condition.
  • SingleOrDefault: returns the single element of a sequence; or the single element that satisfies a condition; or a default value if such an element does not exist .
  • Slice (replace Skip, SkipLast, Take and TakeLast): takes a specified range of contiguous elements from a sequence.
  • Sum: computes the sum of a sequence of numeric values.
  • ToDictionary: creates a Dictionary<TKey,TValue> from a sequence.
  • ToHashSet: creates a HashSet<TValue> from a sequence.
  • ToLookup: creates a ILookup<TKey,TValue> from a sequence.

Status

See the todo.md file to see the current status of the library.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 289 5/22/2023
1.0.0 440 11/14/2021