IO.Github.Hcoona.Collections.CircularList
1.0.2
dotnet add package IO.Github.Hcoona.Collections.CircularList --version 1.0.2
NuGet\Install-Package IO.Github.Hcoona.Collections.CircularList -Version 1.0.2
<PackageReference Include="IO.Github.Hcoona.Collections.CircularList" Version="1.0.2" />
<PackageVersion Include="IO.Github.Hcoona.Collections.CircularList" Version="1.0.2" />
<PackageReference Include="IO.Github.Hcoona.Collections.CircularList" />
paket add IO.Github.Hcoona.Collections.CircularList --version 1.0.2
#r "nuget: IO.Github.Hcoona.Collections.CircularList, 1.0.2"
#:package IO.Github.Hcoona.Collections.CircularList@1.0.2
#addin nuget:?package=IO.Github.Hcoona.Collections.CircularList&version=1.0.2
#tool nuget:?package=IO.Github.Hcoona.Collections.CircularList&version=1.0.2
CircularList
A high-performance, generic circular buffer (circular list) library for .NET, supporting multiple target frameworks. Compatible with .NET Framework 4.6.1+, .NET Core 2.0+, .NET 6/8/9+, and modern .NET platforms.
Features
- Fixed capacity, automatically overwrites the oldest element on overflow
- Generic, fully implements
IList<T>
API - Multi-targeting:
netstandard2.0
,netstandard2.1
,net462
,net8.0
,net9.0
Span<T>
/Memory<T>
support on modern platforms- Overflow event notification when an element is overwritten
- Not thread-safe (add your own locking for concurrency)
Installation
Install from NuGet (assuming package name is CircularList):
# .NET CLI
dotnet add package CircularList
Quick Start
using IO.Github.Hcoona.Collections;
var list = new CircularList<int>(capacity: 3);
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4); // Now 1 is overwritten, list contains [2,3,4]
foreach (var item in list)
{
Console.WriteLine(item); // Outputs 2, 3, 4
}
// Subscribe to overflow event
list.OnOverflow += (sender, overwritten) =>
{
Console.WriteLine($"Overwritten: {overwritten}");
};
Main API
CircularList<T>(int capacity)
: Create a circular list with the specified capacityvoid Add(T item)
: Add an element, overwriting the oldest if fullT this[int index]
: Indexer, 0 is the oldest elementint Capacity
: The fixed capacityint Count
: Current number of elementsevent EventHandler<T> OnOverflow
: Raised when an element is overwrittenReadOnlySpan<T> AsSpan()
: Efficient access to the circular list contentsbool Contains(T item)
: Check if the list contains a specific itemint IndexOf(T item)
: Find the logical index of a specific itemvoid Clear()
: Remove all items from the listvoid CopyTo(T[] array, int arrayIndex)
: Copy all items to an array
Multi-target Framework Support
Target Framework | Compatible Platforms | Modern Features |
---|---|---|
netstandard2.0 | .NET Framework 4.6.1+ | Basic functionality |
netstandard2.1 | .NET Core 3.0+/Mono | Span<T> support |
net462 | .NET Framework 4.6.2+ | Basic functionality |
net8.0 | .NET 8 | All features |
net9.0 | .NET 9 | All features |
Note: On netstandard2.0, System.Memory is referenced automatically to provide Span<T> compatible APIs.
Performance & Use Cases
- Ideal for logs, caches, sliding windows, and any fixed-capacity, cyclic-overwrite scenario
- Backed by an array, O(1) for indexing and adding
- Remove/RemoveAt/Insert operations are not supported (throw NotSupportedException)
- CopyTo/IndexOf/Contains are fully supported for read operations
License
GPL-3.0-or-later
Feedback and contributions are welcome! Open an issue or PR.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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 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 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- System.Memory (>= 4.5.0)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.0)
-
.NETStandard 2.0
- System.Memory (>= 4.5.0)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.0)
-
.NETStandard 2.1
- 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.
Version | Downloads | Last Updated |
---|---|---|
1.0.2 | 114 | 7/15/2025 |
# Release Notes
## Version 1.0.2 (Initial Release)
### Features
- High-performance circular list implementation
- Multi-framework support (.NET Standard 2.0/2.1, .NET Framework 4.6.2, .NET 8.0/9.0)
- O(1) insertion and removal operations
- Efficient buffer management for queue operations
- Support for cyclic data structures
- Comprehensive API documentation
### Performance
- Optimized for high-throughput scenarios
- Memory-efficient implementation
- Support for `Span<T>` and `Memory<T>` on modern platforms
### Compatibility
- Full compatibility with .NET Standard 2.0+ and .NET Framework 4.6.2+
- Tested on multiple target frameworks