ContosoPackage 1.0.0

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

ContosoPackage

NuGet Downloads

A comprehensive utility library providing common helper functions and extensions for .NET applications.

Features

  • String Extensions: Enhanced string manipulation and validation methods
  • DateTime Helpers: Convenient date and time calculation utilities
  • Collection Extensions: Powerful collection manipulation and querying methods

Installation

Install the package via NuGet Package Manager:

Install-Package ContosoPackage

Or via .NET CLI:

dotnet add package ContosoPackage

Usage

String Extensions

using ContosoPackage.Utilities;

string text = "hello world";
string titleCase = text.ToTitleCase(); // "Hello World"

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

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

DateTime Helpers

using ContosoPackage.Utilities;

DateTime today = DateTime.Today;
DateTime startOfWeek = DateTimeHelpers.GetStartOfWeek(today);
DateTime endOfWeek = DateTimeHelpers.GetEndOfWeek(today);

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

bool isWeekend = DateTimeHelpers.IsWeekend(DateTime.Today);

Collection Extensions

using ContosoPackage.Utilities;

var numbers = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var chunks = numbers.Chunk(3); // [[1,2,3], [4,5,6], [7,8,9], [10]]

var items = new List<string> { "apple", "banana", "cherry" };
bool isEmpty = items.IsNullOrEmpty(); // false

var randomItem = items.Random(); // Returns a random item from the list

API Reference

StringExtensions

  • ToTitleCase() - Converts string to title case
  • IsValidEmail() - Validates email format
  • Truncate(int maxLength) - Truncates string with ellipsis

DateTimeHelpers

  • GetStartOfWeek(DateTime date) - Gets Monday of the week
  • GetEndOfWeek(DateTime date) - Gets Sunday of the week
  • CalculateAge(DateTime birthDate, DateTime? asOfDate = null) - Calculates age
  • IsWeekend(DateTime date) - Checks if date is weekend

CollectionExtensions

  • Chunk<T>(int chunkSize) - Splits collection into chunks
  • IsNullOrEmpty<T>() - Checks if collection is null or empty
  • Random<T>() - Returns random element from collection

Requirements

  • .NET 6.0 or later

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

We welcome contributions! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please open an issue on GitHub.


Contoso Corporation - Building better software tools for developers worldwide.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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.0 0 10/17/2025

Initial release with core utility functions.