SharpEssentials is the ultimate C# utility library for .NET developers, helping you write cleaner, more efficient code with zero dependencies.
- Features
- Installation
- Getting Started
- Usage Examples
- Why Choose SharpEssentials?
- Documentation
- Contributing
- Support & Community
- License
Core Utilities
- Argument Validation:
ThrowIfNull,ThrowIfEmpty,ThrowIfInvalid - Type Helpers: Safe casting, null coalescing, enum parsing
- Exception Handling: Retry policies, exception unwrapping
Collections & LINQ
Batch,DistinctBy,ToDictionarySafeForEachWithIndex,Shuffle,Paginate
Functional Programming
Option<T>,Result<T>,Either<L, R>- Pattern matching extensions
String Operations
- Truncation, formatting, validation
- Levenshtein distance, phonetic matching
DateTime Helpers
- Business day calculations
- Timezone conversions
- Human-readable intervals ("2 hours ago")
Use your preferred .NET package manager:
# NuGet Package Manager
Install-Package SharpEssentials
# .NET CLI
dotnet add package SharpEssentials
# Paket CLI
paket add SharpEssentialsCompatibility: .NET 8.0+
using SharpEssentials;
// Validate arguments
order.ThrowIfNull(nameof(order));
// Batch operations
var batches = Enumerable.Range(1, 1000).Batch(100);
// Functional result handling
var result = Result.Try(ParseConfigFile);
result.Match(
success: config => Save(config),
failure: ex => Log.Error(ex)
);var data = await RetryPolicy
.WithExponentialBackoff(3, TimeSpan.FromSeconds(1))
.ExecuteAsync(() => FetchRemoteDataAsync());var clean = " HELLO world ".TrimAll(); // "HELLO world"
var similarity = "color".SimilarityTo("colour"); // 0.91| Metric | SharpEssentials | Alternatives |
|---|---|---|
| Performance | ⚡ Optimized | 🐢 Slower |
| Dependencies | 0 | 3+ |
| Maintenance | Active | Abandoned |
| Documentation | ✅ Comprehensive | Minimal |
- Battle-tested in production
- Consistent, intuitive API
- Detailed XML docs with examples
We welcome your contributions! Please:
- Fork the repo
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m "Add AmazingFeature") - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
git clone https://github.com/yourname/SharpEssentials.git
cd SharpEssentials
dotnet restore
dotnet build
dotnet test- 📚 FAQ
- 🐛 Report Issues
- 💬 Join our Discord
- 📢 Follow us on Twitter and LinkedIn
Distributed under the MIT License. See LICENSE for details.
Thank you for choosing SharpEssentials! 🎉 Happy coding! 💻🚀
