https://github.com/twentyfourminutes/bidirectionaldict
Provides implementations of bidirectional dictionaries for C#.
https://github.com/twentyfourminutes/bidirectionaldict
bidirectional bidirectional-dictionaries bidirectional-dictionary collections csharp csharp8 dictionary dotnet dotnet-core dotnetstandard two-way
Last synced: about 1 year ago
JSON representation
Provides implementations of bidirectional dictionaries for C#.
- Host: GitHub
- URL: https://github.com/twentyfourminutes/bidirectionaldict
- Owner: TwentyFourMinutes
- License: mit
- Created: 2020-01-04T20:24:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-29T07:29:21.000Z (over 5 years ago)
- Last Synced: 2025-04-30T07:08:42.186Z (about 1 year ago)
- Topics: bidirectional, bidirectional-dictionaries, bidirectional-dictionary, collections, csharp, csharp8, dictionary, dotnet, dotnet-core, dotnetstandard, two-way
- Language: C#
- Homepage:
- Size: 74.2 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# BidirectionalDict


Provides simple implementations of bidirectional Dictionaries for C#. BidirectionalDict targets
`.Net Standard 2.1`, `.Net Core 3.1` and `.Net Framework 4.8` so it's available to you on all platforms.
## About
This package brings a basic implementation of a bidirectional Dictionary with it. A bidirectional Dictionary stores two values which are both unique and can each value can be queried by its related partner.
## Installation
You can either get this package by downloading it from the NuGet Package Manager built in Visual Studio, in the [releases](https://github.com/TwentyFourMinutes/BidirectionalDict/releases) tab or from the official [nuget.org](https://www.nuget.org/packages/BidirectionalDict) website.
Also you can install it via the **P**ackage **M**anager **C**onsole:
```
Install-Package BidirectionalDict
```
### Basic example
```c#
BiDictionary dict = new BiDictionary();
dict.TryAdd(0, "Hello World!");
dict.TryGet(0, out string val1);
Console.WriteLine(val1); // HelloWorld!
dict.TryGet("Hello World!", out int val2);
Console.WriteLine(val2); // 0
```
## Features
- C# 8.0 ready
- build upon performance
- compatible with Newtonsoft.JSON
- iterable by foreach
- read-only implementation
- concurrent implementation
## Notes
If you feel like something is not working as intended or you are experiencing issues, feel free to create an issue. Also for feature requests just create an issue. For further information feel free to send me a [mail](mailto:office@twenty-four.dev) to `office@twenty-four.dev` or message me on Discord `24_minutes#7496`.