Snipster 1.0.4.5
dotnet add package Snipster --version 1.0.4.5
NuGet\Install-Package Snipster -Version 1.0.4.5
<PackageReference Include="Snipster" Version="1.0.4.5" />
<PackageVersion Include="Snipster" Version="1.0.4.5" />
<PackageReference Include="Snipster" />
paket add Snipster --version 1.0.4.5
#r "nuget: Snipster, 1.0.4.5"
#:package Snipster@1.0.4.5
#addin nuget:?package=Snipster&version=1.0.4.5
#tool nuget:?package=Snipster&version=1.0.4.5
Snipster
Snipster is a lightweight, open-source .NET utility library that provides a comprehensive collection of helper and extension methods for everyday development tasks — including validation, data formatting, parsing, security, and more. It also includes a generic repository interface with an optional EF Core-based implementation, as well as a flexible cache service for in-memory caching with configurable expiration and validation support.
Available on NuGet
License: MIT
Tags: .NET, utilities, helpers, validations, dotnet, repository, caching, uow, excel
NuGet Packages Used
| Package | .NET Standard 2.0 Version | .NET 6+ Version |
|---|---|---|
| Microsoft.EntityFrameworkCore | 3.1.32 | 6.0.36 |
| Newtonsoft.Json | 13.0.1 | 13.0.1 |
| ClosedXML | 0.95.4 | 0.105.0 |
Installation
Add Snipster to your .NET project using the CLI:
dotnet add package Snipster
Or install via the NuGet Package Manager:
Install-Package Snipster
Documentation
Explore detailed API references, usage guides, and practical examples in the official documentation.
Available Utilities
Validation Extensions
| Category | Method Highlights | Description |
|---|---|---|
| CollectionValEx | IsNullOrEmpty<T>() HasDuplicates<T>() |
Check if a collection is null/empty or has duplicates |
| CreditCardValEx | IsValidCreditCard() |
Validates if a string is a valid card number |
| DateTimeValEx | IsToday() IsFuture() IsPast() IsWeekend() IsWeekday() IsValidDate(format) |
Various date validation helpers |
| JsonValEx | IsValidJson() |
Checks if a string is valid JSON |
| SecurityValEx | IsValidEmail() IsStrongPassword(minLength) |
Email, password validations |
| StringValEx | IsContainsIgnoreCase() IsValidSriLankanPhone() IsValidInternationalPhone() IsNumeric() IsAlphabetic() IsAlphanumeric() |
String-related validations |
| NetworkValEx | IsValidIPv4() IsValidIPv6() IsValidWebAddress() |
Network-related validations |
| ObjectValEx | IsDefaultValue() HasProperty() |
Object-related validations |
Extension Methods
| Category | Method Highlights | Description |
|---|---|---|
| CollectionEx | ChunkBy() ToSafeDictionary() RandomItem() ForEach() MostCommon() Shuffle() LeastCommon() ExceptSafe() |
LINQ-style enhancements for collections |
| CreditCardEx | GetCreditCardType() |
Detects the card brand from a number |
| DateTimeEx | ToUnixTimestamp() FromUnixTimestamp() ToTimeAgo() StartOfDay() EndOfDay() ToTimeZone() FromTimeZone() ToDateString() ToTimeString() ToFullDateTimeString() GetWeekStartDate() GetWeekEndDate() GetWeekOfYear() ToAge() |
Rich date/time formatting and conversions |
| JsonEx | ToJson() FromJson<T>() |
Object-to-JSON and JSON-to-object |
| NumberEx | ToOrdinal() ToIntSafe() ToDoubleSafe() |
Numeric formatting and safe conversion |
| SecurityEx | ToSha256() |
Secure hash generation |
| StringEx | CapitalizeFirst() ToTitleCase() OnlyDigits() Truncate() Slugify() ToBase64() FromBase64() OrDefault() StripHtmlTags() SanitizeAlphanumeric() RemoveSpecialCharacters() ToCamelCase() ToPascalCase() ToKebabCase() RemoveWhitespace() NormalizeSpaces() GetDescription() ToCleanQueryString() |
Powerful string manipulation toolkit |
| ObjectEx | GetPropertyValue() SetPropertyValue() |
Get and set property values by name |
Helper Methods
| Category | Method Highlights | Description |
|---|---|---|
| JsonFx | Minify() Prettify() |
Minify and format JSON strings |
| SecurityFx | RandomString() GenerateSecureToken() PasswordHash() VerifyPassword() |
Security and password utilities |
| StringFx | FormatBytes() GenerateUniqueUsername() GenerateGuid() |
Friendly sizes, safe usernames, GUID control |
| NetworkFx | IsHostAvailableAsync(host) BuildUrl(baseUrl, params) HasInternetConnectionAsync() |
Network & URL Utilities (with Query Parameter Support) |
| FileFx | SafeReadText() SafeReadBytes() SafeWriteText() SafeWriteBytes() CreateTempFile() GetDirectorySize() SanitizeFileName() |
File Handling & Directory Utilities |
| ExcelFx | WriteToExcel() WriteToMemory() |
Write data to a file or memory stream |
| ObjectFx | DeepClone<T>(T) |
Deep clone an object |
IGenericRepository Interface Methods
| Method Highlights | Description |
|---|---|
GetAllAsync() GetAllByConditionAsync() GetByConditionAsync() GetSelectedColumnsAsync() IsExistAsync() AddAsync() AddRangeAsync() Update() UpdateRange() Remove() RemoveAsync() SaveChangesAsync() |
Common generic CRUD operations using Entity Framework Core. Designed for asynchronous and synchronous data handling. |
IUnitOfWork Interface Methods
| Method Highlights | Description |
|---|---|
Repository<TEntity>() BeginTransactionAsync() CommitAsync() RollbackAsync() SaveChangesAsync() |
Centralized transaction and repository management with EF Core, supporting async and sync operations. |
ICacheService Interface Methods
| Method Highlights | Description |
|---|---|
SetCacheAsync() |
Sets a cache entry with default duration (5 min) asynchronously |
SetCacheAsync(duration) |
Sets a cache entry with a specified duration asynchronously |
SetLongCacheAsync() |
Sets a cache entry with a long (60 min) expiration asynchronously |
RemoveCache() |
Removes a cache entry |
Contributions
Pull requests, suggestions, and feedback are welcome!
Feel free to fork and improve or extend the utility set for the .NET community.
Contributors
Thanks to these wonderful people for their contributions!
Contributors Graph
Maintainers
This project is maintained by Darshana Wijesinghe.
Support & Contact
Email : dar.dev.mail@gmail.com
LinkedIn: darwijesinghe
Website : Portfolio
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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. |
-
.NETStandard 2.0
- ClosedXML (>= 0.95.4)
- Microsoft.EntityFrameworkCore (>= 3.1.32)
- Newtonsoft.Json (>= 13.0.1)
-
net6.0
- ClosedXML (>= 0.105.0)
- Microsoft.EntityFrameworkCore (>= 6.0.36)
- Newtonsoft.Json (>= 13.0.1)
GitHub repositories
This package is not used by any popular GitHub repositories.
See full release notes at https://github.com/darwijesinghe/snipster/blob/main/RELEASE_NOTES.md