H073.RelationMatrix
1.0.0
Prefix Reserved
dotnet add package H073.RelationMatrix --version 1.0.0
NuGet\Install-Package H073.RelationMatrix -Version 1.0.0
<PackageReference Include="H073.RelationMatrix" Version="1.0.0" />
paket add H073.RelationMatrix --version 1.0.0
#r "nuget: H073.RelationMatrix, 1.0.0"
// Install H073.RelationMatrix as a Cake Addin #addin nuget:?package=H073.RelationMatrix&version=1.0.0 // Install H073.RelationMatrix as a Cake Tool #tool nuget:?package=H073.RelationMatrix&version=1.0.0
RelationMatrix API Documentation
RelationMatrix
is a wicked class that helps you manage a nested dictionary structure. It provides a way to set and check values, and it comes with a couple of events to notify you when things change. Let's get into the details!
Class Definition
internal class RelationMatrix<K, KK, V>
K
: The type of the first key.KK
: The type of the second key.V
: The type of the value.
Methods
V? Check(K key, KK keyKey)
Checks for a value with the given keys.
- Parameters:
key
: The first key.keyKey
: The second key.
- Returns: The value if found; otherwise,
null
.
void Set(K key, KK keyKey, V value)
Sets a value with the given keys.
- Parameters:
key
: The first key.keyKey
: The second key.value
: The value to set.
void Set(Dictionary<K, Dictionary<KK, V>> data)
Sets the entire data dictionary.
- Parameters:
data
: The new data dictionary.
Events
ValueSet
Occurs when a value is set. The event args contain the keys and value.
- Event Args:
Key
: The first key.KeyKey
: The second key.Value
: The set value.
ValueChecked
Occurs when a value is checked. The event args contain the keys.
- Event Args:
Key
: The first key.KeyKey
: The second key.
How to Use
Create an instance of RelationMatrix
, then use the Set
and Check
methods to manage values. You can also subscribe to the ValueSet
and ValueChecked
events to respond to changes and checks.
Here's an example:
var matrix = new RelationMatrix<string, int, bool>();
matrix.ValueSet += (sender, args) => Console.WriteLine($"Value set: {args.Key}, {args.KeyKey}, {args.Value}");
matrix.Set("foo", 42, true);
bool? value = matrix.Check("foo", 42);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
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.0 | 167 | 8/25/2023 |