Snipster 1.0.4.5

dotnet add package Snipster --version 1.0.4.5
                    
NuGet\Install-Package Snipster -Version 1.0.4.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Snipster" Version="1.0.4.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Snipster" Version="1.0.4.5" />
                    
Directory.Packages.props
<PackageReference Include="Snipster" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Snipster --version 1.0.4.5
                    
#r "nuget: Snipster, 1.0.4.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Snipster@1.0.4.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Snipster&version=1.0.4.5
                    
Install as a Cake Addin
#tool nuget:?package=Snipster&version=1.0.4.5
                    
Install as a Cake Tool

Snipster

NuGet version NuGet Downloads GitHub license Maintenance

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4.5 0 10/27/2025
1.0.4.4 0 10/20/2025
1.0.4.3 0 10/20/2025
1.0.4.2 0 10/5/2025
1.0.4.1 0 10/5/2025
1.0.4 0 10/4/2025
1.0.3 0 8/19/2025
1.0.2 0 8/12/2025
1.0.1 0 8/12/2025
1.0.0 0 8/12/2025