Generic.Helpers.Attributes 1.0.2

dotnet add package Generic.Helpers.Attributes --version 1.0.2
                    
NuGet\Install-Package Generic.Helpers.Attributes -Version 1.0.2
                    
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="Generic.Helpers.Attributes" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Generic.Helpers.Attributes" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Generic.Helpers.Attributes" />
                    
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 Generic.Helpers.Attributes --version 1.0.2
                    
#r "nuget: Generic.Helpers.Attributes, 1.0.2"
                    
#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 Generic.Helpers.Attributes@1.0.2
                    
#: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=Generic.Helpers.Attributes&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Generic.Helpers.Attributes&version=1.0.2
                    
Install as a Cake Tool

Generic.Helpers.Attributes

A simple and useful .NET utility library providing common helper functions for string manipulation, date handling, and validation.

Installation

dotnet add package Generic.Helpers.Attributes

Or via NuGet Package Manager:

Install-Package Generic.Helpers.Attributes

Features

String Extensions

  • Truncate: Truncate strings with ellipsis
  • ToTitleCase: Convert strings to title case
  • IsValidEmail: Validate email addresses
  • RemoveWhitespace: Remove all whitespace from strings

DateTime Extensions

  • StartOfDay/EndOfDay: Get the start or end of a day
  • IsWeekend: Check if a date falls on a weekend
  • GetAge: Calculate age from a birth date
  • ToRelativeTime: Get friendly relative time strings (e.g., "2 hours ago")

Validation Utilities

  • RequireNonEmpty: Validate non-empty strings
  • RequireInRange: Validate values within a range
  • RequireNotNull: Validate non-null objects
  • RequireNonEmpty: Validate non-empty collections

Usage Examples

String Extensions

using AllHelpers.Extensions;

string text = "This is a very long string that needs truncating";
string truncated = text.Truncate(20); // "This is a very lo..."

string email = "test@example.com";
bool isValid = email.IsValidEmail(); // true

string name = "john doe";
string titleCase = name.ToTitleCase(); // "John Doe"

DateTime Extensions

using AllHelpers.Extensions;

DateTime date = DateTime.Now;
bool weekend = date.IsWeekend();

DateTime birthDate = new DateTime(1990, 5, 15);
int age = birthDate.GetAge();

DateTime past = DateTime.Now.AddHours(-3);
string relative = past.ToRelativeTime(); // "3 hours ago"

Validation Utilities

using AllHelpers.Utilities;

void ProcessName(string name)
{
    Validator.RequireNonEmpty(name, nameof(name));
    // Process the name...
}

void SetAge(int age)
{
    Validator.RequireInRange(age, 0, 150, nameof(age));
    // Set the age...
}

License

MIT License - feel free to use this in your projects!

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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
1.0.2 131 2/2/2026