MultiKeyLookup 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MultiKeyLookup --version 1.0.0
NuGet\Install-Package MultiKeyLookup -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="MultiKeyLookup" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MultiKeyLookup --version 1.0.0
#r "nuget: MultiKeyLookup, 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.
// Install MultiKeyLookup as a Cake Addin
#addin nuget:?package=MultiKeyLookup&version=1.0.0

// Install MultiKeyLookup as a Cake Tool
#tool nuget:?package=MultiKeyLookup&version=1.0.0

multi-key-lookup

A data structure that allows indexing by multiple fields for fast data access.

Basic Usage

Pass the data and an array of index fields to the constructor. Get the data with a field and value.


public class DataClass
{
  public int A { get; set; }
  public int B { get; set; }
  public int C { get; set; }
}

public void Get() 
{
    var Data = new DataClass[] {new DataClass() { A = 1, B = 2, C = 3 }, 
    new DataClass() { A = 1, B = 3, C = 2 }, new DataClass(){ A = 3, B = 2, C = 1}};
    var Indexed = new MultiKeyLookup(Data, ("A", k => k.A), ("B", k => k.B));

    IEnumerable<DataClass> A1 = Indexed.get('A', 1);
    IEnumerable<DataClass> B2 = Indexed.get('B', 2);

    //prints [{a: 1, b: 2, c: 3}, {a: 1, b: 3, c: 2}]
    Console.WriteLine(A1);

    //prints [{a: 1, b: 2, c: 3}, {a: 3, b: 2, c: 1}]
    Console.WriteLine(B2);
}

API

new MultiKeyLookup(data, ...indexes); //data and indexes are optional
Count; //the number of data entries
Indexes; //the number of indexes
Values; //gets an iterable of values
AddIndex((field, key)); //indexes the data by another index
RemoveIndex(field); //removes an index
Add(...data); //adds data
ContainsKey(field, value, key); //does the data exist by field and value, key needed for no index
TryGetValue(field, value, key); //gets the data by field and value, key needed for no index
Get(field, value, key); //gets the data by field and value, key needed for no index
Remove(field, value, key); //removes the data by field and value, key needed for no index
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. 
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.0.3 260 2/24/2023
1.0.2 420 6/27/2021
1.0.1 393 6/27/2021
1.0.0 409 6/25/2021

First release.