Introduction
CapyKit is a practical toolkit for .NET applications. It collects common helpers and extension methods into one package so application code can stay focused on business behavior instead of re-implementing the same plumbing in every project.
The project began as shared infrastructure for HappyCapy and is now available as a standalone library. It currently targets .NET 8.
What CapyKit Provides
Extension Methods
The CapyKit.Extensions namespace contains helpers for common language and LINQ tasks:
StringExtensionsprovides fallback helpers such asIfNullOrEmptyandIfNullOrWhiteSpace.LINQExtensionsadds pagination, page counts, inverted filtering, and left outer join helpers for enumerable and queryable collections.EnumerationExtensionsmakes enum names, numeric values, descriptions, and human-readable names easier to retrieve.ObjectExtensionscopies matching writable properties from one object to another.
Helper Classes
The CapyKit.Helpers namespace contains focused utility classes:
SerializationHelperserializes and deserializes values withSystem.Text.Json.CompressionHelpercompresses serialized values with gzip and can represent compressed data as Base64.SecurityHelpercreates PBKDF2 password hashes, salts, random strings, and random passwords.KeyHelpercreates and validates formatted HMAC-backed keys using a caller-provided master key.CalculationHelperincludes distance calculations, unit conversion, angle conversion, and quick non-cryptographic hash helpers.LanguageHelperconverts camel case identifiers into human-readable text.
Core Utility Types
The root CapyKit namespace includes small types that support the helpers:
Password,IPasswordAlgorithm, andPbkdf2Algorithmmodel password hashing.Pool<T>andPoolItem<T>provide a simple resource pool abstraction.PropertyComparer<T, U>compares objects by a selected property.CapyEventReporter,CapyEventArgs, andEventLevelexpose library diagnostics without requiring a specific logging package.NamedColorprovides a large named color enumeration based on the XKCD color survey palette.
Design Approach
CapyKit favors explicit, discoverable APIs. Most helpers are static methods or extension methods and can be adopted independently. You can use only the namespaces you need, and the library does not impose dependency injection, hosting, logging, or configuration conventions on the consuming application.
Where CapyKit needs to communicate warnings or errors internally, it uses CapyEventReporter. Applications can subscribe to these events and map them into their preferred logging, telemetry, or diagnostics system.
API Reference
The generated API reference is available through the DocFX navigation and starts at API Reference. Use it for exact signatures, overloads, return types, exceptions, and XML comment details.