IX.Guaranteed
1.0.0
dotnet add package IX.Guaranteed --version 1.0.0
NuGet\Install-Package IX.Guaranteed -Version 1.0.0
<PackageReference Include="IX.Guaranteed" Version="1.0.0" />
<PackageVersion Include="IX.Guaranteed" Version="1.0.0" />
<PackageReference Include="IX.Guaranteed" />
paket add IX.Guaranteed --version 1.0.0
#r "nuget: IX.Guaranteed, 1.0.0"
#:package IX.Guaranteed@1.0.0
#addin nuget:?package=IX.Guaranteed&version=1.0.0
#tool nuget:?package=IX.Guaranteed&version=1.0.0
IX.Guaranteed
A small .NET library providing simple thread-safe collection implementations.
Overview
IX.Guaranteed includes safe concurrent wrappers over common collection types:
ThreadSafeDictionary<TKey, TValue>ThreadSafeList<T>ThreadSafeQueue<T>ThreadSafeStack<T>ThreadSafeEnumerator<T>
Each collection synchronizes access so multiple readers can safely enumerate or inspect the data while writes are protected.
Features
ThreadSafeDictionary<TKey, TValue>- Implements
IDictionary<TKey, TValue>andIDisposable - Supports thread-safe add, remove, contains, indexer access, and snapshots for
KeysandValues
- Implements
ThreadSafeList<T>- Implements
IList<T>andIDisposable - Provides safe add, remove, insert, indexer access, enumeration, and clear operations
- Implements
ThreadSafeQueue<T>- Implements
IEnumerable<T>andIDisposable - Supports
Enqueue,Dequeue,Peek,TryDequeue,TryPeek, and thread-safe enumeration
- Implements
ThreadSafeStack<T>- Implements
IEnumerable<T>andIDisposable - Supports
Push,Pop,Peek,TryPop,TryPeek,ToArray, and thread-safe enumeration
- Implements
ThreadSafeEnumerator<T>- Holds a read lock for the duration of enumeration
- Used internally by the collection wrappers to safely iterate while protecting concurrent access
Usage
using IX.Guaranteed.Collections;
var list = new ThreadSafeList<int>();
list.Add(1);
list.Add(2);
foreach (var item in list)
{
Console.WriteLine(item);
}
var queue = new ThreadSafeQueue<string>();
queue.Enqueue("first");
queue.Enqueue("second");
if (queue.TryDequeue(out var value))
{
Console.WriteLine(value);
}
var dictionary = new ThreadSafeDictionary<string, int>();
dictionary["one"] = 1;
if (dictionary.TryGetValue("one", out var result))
{
Console.WriteLine(result);
}
Notes
- The collection implementations are designed to make common operations thread-safe using locks.
ThreadSafeList<T>,ThreadSafeDictionary<TKey, TValue>,ThreadSafeQueue<T>, andThreadSafeStack<T>are disposable and should be disposed when no longer needed.- Enumeration is safe because
ThreadSafeEnumerator<T>acquires a read lock for the lifetime of the enumeration.
Project
The library is intended as a lightweight, guaranteed thread-safe collection utility for .NET applications.
AI notice
The code in this project has been created with the use of local AI models. No cloud-based AI models have been used.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.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.