Pineapple: Guava-inspired core utilities for .NET
Pineapple is a free, open-source C# library of small, well-tested building blocks for .NET 8 and .NET 10 — guard clauses, URL-safe ShortGuids, a deterministic hash code, SQL Server row versions, rate limiting, timeouts, and backoff. Stop rewriting the same helpers in every project.
dotnet add package Pineapple
What’s in the box
Guard clauses
One-line argument checks for null, whitespace, ranges, dates, URIs, and GUIDs.
ShortGuid
A Guid as 22 URL-safe characters, with implicit conversions to Guid and string.
Deterministic HashCode
xxHash32 hashes that are identical across processes, machines, and restarts.
RowVersion
Compare and convert SQL Server rowversion values as a 64-bit struct.
Rate limiting
Cap calls per minute to an API or database with scopes and resource governors.
Timeouts & backoff
Deadlines, exponential waits, and CPU-aware degrees of parallelism.
Diagnostics
Time operations with ILogger using a single using block.
Cleanup & async
Exception-safe cleanup and synchronization-context scopes.
Health & networking
Probe ports, URLs, and processes; decompress Brotli responses.
Pineapple.Data
Query SQL Server INFORMATION_SCHEMA with EF Core and check availability.
A taste
using Pineapple.Common;
using static Pineapple.Common.Preconditions;
public Order Create(string customerId, int quantity, DateTime requestedAt)
{
CheckIsNotNullOrWhitespace(nameof(customerId), customerId);
CheckIsNotLessThan(nameof(quantity), quantity, 1);
CheckIsValidDateRange(nameof(requestedAt), requestedAt, plusOrMinusInHours: 24);
ShortGuid id = ShortGuid.NewGuid(); // e.g. "xnS5yWvbWE2Ky1Ue7PZkZw"
return new Order(id.Guid, customerId, quantity);
}
Why Pineapple
- Small and focused. Each type solves one recurring problem and has no framework opinions.
- Modern .NET. Targets .NET 8 and .NET 10 LTS, with SourceLink and symbol packages for step-through debugging.
- Tested. Maintained by MILL5 since 2019, with unit tests run on .NET 8 and .NET 10 in CI.
- Free. Apache 2.0 licensed.
Part of the MILL5 open-source family
Pineapple is one of many open-source .NET libraries and tools built by MILL5, a Boston-based Microsoft Gold Partner.
FastSearch
Fast, low-memory substring search for .NET 10. NGramSearch indexes 1M items in about a second with 47 MiB.
M5.BloomFilter
Probabilistic Bloom filters for membership testing at scale, with JSON and Protobuf serialization.
yocto
An extremely small, low-on-ceremony, high-on-value Inversion of Control container for .NET.
Polygon.Net
A C# wrapper for the Polygon.io financial data API: stocks, options, forex, and crypto.
Cut & Move
A free macOS menu bar utility that adds real Cmd+X cut-and-move to Finder.
MacEdgeLight
An ambient screen-edge light for macOS that replaces a ring light on video calls.
Frequently asked questions
What is Pineapple for .NET?
Pineapple is a free, open-source (Apache 2.0) C# library from MILL5 that provides core utilities for .NET 8 and .NET 10 — guard clauses, ShortGuid, a deterministic HashCode, a SQL Server RowVersion type, rate limiting, resource governors, timeouts, exponential backoff, and timing scopes. It is inspired by Google’s Guava library for Java.
How do I install Pineapple?
Run dotnet add package Pineapple. For SQL Server and Entity Framework Core helpers, also run dotnet add package Pineapple.Data.
Which .NET versions does Pineapple support?
Pineapple 2.x targets .NET 8 (LTS) and .NET 10 (LTS). Pineapple 1.0.41 is the last release that targets .NET Standard 2.0 and .NET Framework.
Is Pineapple free for commercial use?
Yes. Pineapple is licensed under the Apache License 2.0, which permits commercial use, modification, and redistribution.
Who built Pineapple?
Pineapple was built by Richard Crane, a Microsoft Most Valuable Professional (MVP) and founder of MILL5, a Boston-based Microsoft Gold Partner specializing in cloud, AI, IoT, data analytics and modern application development.