Eventualist.Extensions
5.0.0.1
See the version list below for details.
dotnet add package Eventualist.Extensions --version 5.0.0.1
NuGet\Install-Package Eventualist.Extensions -Version 5.0.0.1
<PackageReference Include="Eventualist.Extensions" Version="5.0.0.1" />
<PackageVersion Include="Eventualist.Extensions" Version="5.0.0.1" />
<PackageReference Include="Eventualist.Extensions" />
paket add Eventualist.Extensions --version 5.0.0.1
#r "nuget: Eventualist.Extensions, 5.0.0.1"
#:package Eventualist.Extensions@5.0.0.1
#addin nuget:?package=Eventualist.Extensions&version=5.0.0.1
#tool nuget:?package=Eventualist.Extensions&version=5.0.0.1
Eventualist.Extensions
A collection of lightweight, focused extension methods for common .NET types. Originally created for personal projects but available for anyone to use.
⚠️ Disclaimer
This library is primarily developed for personal use and experimentation. While it is publicly available and contributions are welcome, please note:
- No Warranty: This software is provided "as is", without warranty of any kind, express or implied
- Use at Your Own Risk: The library may contain bugs or incomplete features
- Breaking Changes: API changes may occur between versions without extensive deprecation notices
- Limited Support: Support and maintenance are provided on a best-effort basis
- Experimental Features: Some features may be experimental, especially those targeting preview versions of .NET
For production use, please thoroughly test the library in your specific context and consider pinning to a specific version.
Features
Boolean Extensions
AddNot(string text, string negation = "not ")- Conditionally prefixes a string with a negation word based on the boolean valuefalse.AddNot("implemented") // Returns "not implemented" true.AddNot("implemented") // Returns "implemented"ToYesOrNo(string yes = "yes", string no = "no", string unknown = "unknown")- Converts boolean to yes/no strings (supports nullable booleans)true.ToYesOrNo() // Returns "yes" false.ToYesOrNo() // Returns "no" ((bool?)null).ToYesOrNo() // Returns "unknown"
Collection Extensions
IsEmpty<T>()- Returns true if the collection is emptyIsNotEmpty<T>()- Returns true if the collection contains any elementsDivide<T>(int maxLength)- Splits a collection into sublists with a specified maximum lengthvar numbers = new[] { 1, 2, 3, 4, 5, 6, 7 }; var chunks = numbers.Divide(3); // Returns [[1,2,3], [4,5,6], [7]]
String Extensions
Titleize()- Converts a string to title caseAbbreviate(int maxLength)- Shortens a string to a maximum length with ellipsisTruncate(int maxLength)- Truncates a string to a maximum lengthStripHtml()- Removes HTML tags from a stringHasCorrectExtension(string expectedExtension)- Validates file extensionConvertToMimeType()- Converts file extension to MIME type
DateTime Extensions & Validation
MustComeBeforeAttribute - Validation attribute to ensure one DateTime property precedes anotherpublic class TimePeriod { [MustComeBefore("EndDate")] public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } }
Function Memoization
Memoize()- Automatically caches function results for improved performanceFunc<int, int> expensiveOperation = x => { /* ... */ }; var memoized = expensiveOperation.Memoize(); // First call computes and caches result var result1 = memoized(5); // Subsequent calls with same input return cached result var result2 = memoized(5); // Instant return from cache- Supports functions with up to two arguments
- Note: Not optimized for recursive functions
ExtendedDictionary
- Thread-safe dictionary implementation with improved performance characteristics
Installation
Add the package reference to your project:
<PackageReference Include="Eventualist.Extensions" Version="4.0.0.3-dev0004" />
Or via the .NET CLI:
dotnet add package Eventualist.Extensions
Compatibility
- Target Framework: .NET 10.0 (net10.0)
- C# Language Version: 14.0
- License: MIT
Version History
- 4.0.0.3-dev0004: Updated to .NET 10 and C# 14, refreshed CI workflow
- 3.x: Updates for .NET 9 compatibility
- 2.0.0.0: .NET 6.0 compatibility (use version 1.0.0.19 for older frameworks)
- 1.0.0.13: Added Memoize functionality
- 1.0.0.0: Initial release with Bool and Collection extensions
Building and Testing
The project includes a GitHub Actions CI workflow (.github/workflows/dotnet.yml) that automatically:
- Restores NuGet packages
- Builds the solution using .NET 10 SDK
- Runs all unit tests
Local Development
# Restore dependencies
dotnet restore
# Build the solution
dotnet build
# Run tests
dotnet test
# Create NuGet package
dotnet pack
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Run
dotnet testlocally to ensure all tests pass - Submit a pull request
Author
Iede Snoek
Email: info@esoxsolutions.nl
Company: Esox Solutions
License
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2022-2025 Esox Solutions
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.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 |
|---|---|---|
| 5.0.3 | 31 | 2/27/2026 |
| 5.0.2 | 433 | 12/10/2025 |
| 5.0.1 | 423 | 12/10/2025 |
| 5.0.0.1 | 191 | 11/15/2025 |
| 4.0.0.4 | 227 | 6/5/2025 |
| 3.0.0.17 | 369 | 11/25/2023 |
| 3.0.0.9 | 191 | 11/25/2023 |
| 2.0.0.17 | 361 | 3/5/2023 |
| 2.0.0.15 | 411 | 1/29/2023 |
| 2.0.0.11 | 536 | 9/3/2022 |
| 2.0.0.9 | 568 | 7/14/2022 |
| 2.0.0.1 | 566 | 7/14/2022 |
| 1.0.0.19 | 716 | 1/4/2021 |