RegistryLinkedList 1.0.0
dotnet add package RegistryLinkedList --version 1.0.0
NuGet\Install-Package RegistryLinkedList -Version 1.0.0
<PackageReference Include="RegistryLinkedList" Version="1.0.0" />
<PackageVersion Include="RegistryLinkedList" Version="1.0.0" />
<PackageReference Include="RegistryLinkedList" />
paket add RegistryLinkedList --version 1.0.0
#r "nuget: RegistryLinkedList, 1.0.0"
#:package RegistryLinkedList@1.0.0
#addin nuget:?package=RegistryLinkedList&version=1.0.0
#tool nuget:?package=RegistryLinkedList&version=1.0.0
RegistryLinkedList
RegistryLinkedList is a simple IList<T>-like collection that stores unmanaged numeric values in the Windows Registry as a single binary value. The collection keeps an in-memory cache and watches the registry key for external changes; local modifications are persisted back to the registry and external changes refresh the cache and raise a notification.
Requirements
- Windows (uses Microsoft.Win32.Registry)
- .NET Framework 4.8, .NET 6 or .NET 8
Installation
Build the project and reference the resulting assembly in your solution, or add the project to your solution.
Add the required namespaces:
using Microsoft.Win32; using PhoenixTools.Registry;
Quick start
Create a list that stores 32-bit integers under HKCU:\Software\MyApp\MyList in a value named "Values":
using var list = new RegistryLinkedList<int>(RegistryHive.CurrentUser, "Software\\MyApp\\MyList", "Values");
list.Add(10);
list.Add(20);
Console.WriteLine($"Count = {list.Count}");
foreach (var v in list)
Console.WriteLine(v);
Listening for external changes
The collection exposes a ListChanged event which is raised after local updates or when the registry value is modified by another process.
using var list = new RegistryLinkedList<long>(RegistryHive.CurrentUser, "Software\\MyApp\\MyList", "Values");
list.ListChanged += (s, e) =>
{
Console.WriteLine("Registry-backed list changed (local or external).");
};
list.Add(12345); // will trigger ListChanged
Supported operations
RegistryLinkedList<T> implements IList<T> and supports the usual operations:
- Add(item)
- Remove(item)
- Clear()
- Insert(index, item)
- RemoveAt(index)
- IndexOf(item), Contains(item), CopyTo(array, index)
- Count, IsReadOnly
Supported generic types
T must be an unmanaged numeric type. Typical supported types include:
- byte, sbyte, short, ushort, int, uint, long, ulong, float, double
(The implementation serializes raw binary representations of values; make sure the chosen type matches your intentions.)
Behavior and limitations
- Values are serialized into a single REG_BINARY under the provided value name.
- The collection maintains an in-memory cache for performance and synchronizes it with registry storage on changes.
- There is no transaction or advanced concurrency control: updates overwrite the entire binary blob.
- Required registry permissions depend on the hive and key; operations may throw security-related exceptions if permissions are insufficient.
Error handling
- Constructor will throw ArgumentNullException if key or storage arguments are null or whitespace.
- InvalidDataException may be thrown if existing registry content has an unexpected format.
Recommendations
- Always dispose the RegistryLinkedList (use
using) so the internal registry watcher is stopped and unsubscribed. - Subscribe to ListChanged if your application must react to changes made by other processes.
- Prefer fixed-width numeric types (e.g., int, long) for predictable binary layout across runtimes.
Example use case
Store a short run history across application instances so new instances can observe previous run identifiers:
using var runs = new RegistryLinkedList<int>(RegistryHive.CurrentUser, "Software\\MyApp\\RunIds", "RunIds");
runs.Add(Environment.TickCount);
License
MIT license.
Support
Open an issue in the repository for questions or bug reports.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- RegistryWatcher (>= 1.1.0)
-
net6.0-windows7.0
- RegistryWatcher (>= 1.1.0)
-
net8.0-windows7.0
- RegistryWatcher (>= 1.1.0)
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 | 91 | 8/30/2026 |
Initial release