KnightwareCore 3.2.1

dotnet add package KnightwareCore --version 3.2.1
                    
NuGet\Install-Package KnightwareCore -Version 3.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KnightwareCore" Version="3.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KnightwareCore" Version="3.2.1" />
                    
Directory.Packages.props
<PackageReference Include="KnightwareCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KnightwareCore --version 3.2.1
                    
#r "nuget: KnightwareCore, 3.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package KnightwareCore@3.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=KnightwareCore&version=3.2.1
                    
Install as a Cake Addin
#tool nuget:?package=KnightwareCore&version=3.2.1
                    
Install as a Cake Tool

KnightwareCore

A .NET Standard 2.0 library providing helpful utility classes for threading, networking, collections, and other common patterns frequently used across projects.

CI codecov NuGet

Installation

dotnet add package KnightwareCore

Features

Threading & Async Primitives (Knightware.Threading / Knightware.Threading.Tasks)

Class Description
AsyncLock A reentrant async-compatible lock, allowing await inside critical sections
AsyncAutoResetEvent Async-compatible auto-reset event for signaling between tasks
AsyncSemaphore Async-compatible semaphore for limiting concurrent access
AsyncListProcessor<T> Thread-safe queue that processes items sequentially with configurable parallelism
AutoResetWorker Background worker triggered by an auto-reset event with optional periodic execution
BatchProcessor<TRequest, TResponse> Batches incoming requests and processes them based on time/count thresholds
ResourcePool<T> Generic connection/resource pool with automatic scaling based on demand
Dispatcher SynchronizationContext-aware dispatcher for marshaling calls to a specific context

Example: AsyncLock

private readonly AsyncLock _lock = new AsyncLock();

public async Task DoWorkAsync()
{
    using (await _lock.LockAsync())
    {
        // Thread-safe async work here
        await SomeAsyncOperation();
    }
}

Example: BatchProcessor

var batchProcessor = new BatchProcessor<Request, Response>();
await batchProcessor.StartupAsync(
    async batch => {
        // Process all requests in the batch at once
        foreach (var item in batch)
            item.SetResponse(await ProcessAsync(item.Request));
    },
    minimumTimeInterval: TimeSpan.FromMilliseconds(100),
    maximumTimeInterval: TimeSpan.FromSeconds(1),
    maximumCount: 50
);

Collections (Knightware.Collections)

Class Description
NotifyingObservableCollection<T> ObservableCollection that raises events when item properties change (via INotifyPropertyChanged)
CompositeCollection Combines multiple collections into a single virtual collection with change notification
Grouping<TKey, TElement> Simple IGrouping<TKey, TElement> implementation
ListExtensions Extension methods for list manipulation

Example: NotifyingObservableCollection

var collection = new NotifyingObservableCollection<MyItem>();
collection.CollectionItemChanged += (sender, e) => {
    Console.WriteLine($"Item at index {e.Index} property '{e.PropertyName}' changed");
};

Networking (Knightware.Net)

Class Description
TCPSocket Async TCP client wrapper with simple startup/shutdown lifecycle
UDPSocket Async UDP socket for sending/receiving datagrams
UDPMulticastListener Listens for UDP multicast traffic on a specified group

Example: TCPSocket

var socket = new TCPSocket();
if (await socket.StartupAsync("192.168.1.100", 5000))
{
    await socket.WriteAsync(data, 0, data.Length);
    int bytesRead = await socket.ReadAsync(buffer, 0, buffer.Length);
}
await socket.ShutdownAsync();

Diagnostics (Knightware.Diagnostics)

Class Description
TraceQueue Static trace/logging queue with configurable tracing levels and async processing
TraceMessage Represents a single trace message with timestamp, level, and content
TracingLevel Enum defining trace levels (Success, Warning, Error, etc.)

Example: TraceQueue

TraceQueue.TracingLevel = TracingLevel.Warning;
TraceQueue.TraceMessageRaised += msg => Console.WriteLine($"[{msg.Level}] {msg.Message}");
TraceQueue.Trace(this, TracingLevel.Warning, "Something happened: {0}", details);

Primitives (Knightware.Primitives)

Platform-independent primitive types useful in cross-platform scenarios:

Struct Description
Color ARGB color with parsing and equality support
Point 2D point (X, Y)
Size Width and Height
Rectangle Position and size combined
Thickness Four-sided thickness (Left, Top, Right, Bottom)

IO (Knightware.IO)

Class Description
GZipStreamDecompressor Decompresses GZip streams
XmlDeserializer Helper for deserializing XML content

Base Classes (Knightware)

Class Description
PropertyChangedBase Base class implementing INotifyPropertyChanged with [CallerMemberName] support
DispatcherPropertyChangedBase PropertyChangedBase with automatic dispatcher marshaling for UI binding
TimedCacheWeakReference<T> Weak reference that maintains a strong reference for a configurable duration

Example: PropertyChangedBase

public class MyViewModel : PropertyChangedBase
{
    private string _name;
    public string Name
    {
        get => _name;
        set { _name = value; OnPropertyChanged(); }
    }
}

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Product 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 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.  net9.0 was computed.  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 was computed. 
.NET Framework net461 was computed.  net462 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on KnightwareCore:

Package Downloads
SpyderClientLibrary

Library for controlling the Spyder 200/300/X20/X80 video processor families. Provides UDP control, server auto-discovery, drawing data (live display info), file transfer services, and image cache management.

Vista.Controllers.ScreenMaster3

Hardware Library for the ScreenMaster3 3216 and SM3-3216 hardware controllers made by Vista Control Systems.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.1 169 2/1/2026
3.1.0 4,428 11/28/2019
3.0.0 1,534 7/26/2018
2.0.6 1,575 9/25/2016
2.0.5 1,472 9/25/2016
2.0.4 1,446 9/25/2016
2.0.3 1,459 9/25/2016
2.0.2 1,710 9/23/2016
2.0.1 1,780 6/29/2016
2.0.0 1,474 6/29/2016
1.0.9 1,791 12/8/2015
1.0.8 1,701 12/7/2015
1.0.7 1,508 10/28/2015
1.0.6 1,495 10/28/2015
1.0.5 1,447 10/28/2015
1.0.4 1,482 10/28/2015
1.0.3 1,500 10/28/2015
1.0.2 1,491 10/28/2015
1.0.1 1,487 10/28/2015
1.0.0 1,760 8/30/2015