Tildom.Extensions 9.0.0

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

Tildom.Extensions

A comprehensive collection of extension methods for .NET, designed to simplify and enhance your coding experience with DateTime, Enumerables, IO, Strings, and object manipulation utilities.

Features

  • DateAndTime: Extensions for DateTime calculations including calendar quarter, financial quarter, and financial year.
  • Enumerables: Helper extensions for working with collections (checking for null/empty, calculating statistics like median, mode, standard deviation, partitioning data).
  • IO: File path validation and unique file path generation based on several versioning strategies.
  • Strings: String manipulation and validation extensions, including JSON string detection, randomization, occurrence removal, and person name normalization.
  • Utilities: Advanced operations like deep cloning and deep comparison of objects.

Installation

This library is available as a NuGet package. You can install it using the following command:

dotnet add package Tildom.Extensions

Key Components

Deep Object Operations

The library provides powerful tools for working with complex object graphs:

DeepCloneExtensions

Create deep copies of objects with full control over the cloning process:

// Simple deep clone
var clone = originalObject.DeepClone();

// With custom options
var options = new DeepCloneOptions {
    AllowCreateWithoutConstructor = false,
    ContinueOnError = true
};
var clone = originalObject.DeepClone(options: options);

// Non-throwing variant that returns detailed results
var result = originalObject.TryDeepClone();
if (result.IsSuccess) {
    var clone = result.Value;
    foreach (var warning in result.Warnings) {
        Console.WriteLine(warning);
    }
}
DeepCompareExtensions

Deeply compare objects by recursively examining all their properties and fields:

// Simple comparison
bool areEqual = obj1.DeepEquals(obj2);

// With customized comparison behavior
var options = new DeepCompareOptions {
    IgnoreCase = true,
    CompareCollectionsAsSet = true,
    FloatingPointTolerance = 0.001,
    IgnoreMembers = new HashSet<string> { "Id", "CreatedAt" }
};
bool areEqual = obj1.DeepEquals(obj2, options: options);

// Get detailed difference information
var result = obj1.TryDeepEquals(obj2);
if (result.IsSuccess && !result.AreEqual) {
    foreach (var difference in result.Differences) {
        Console.WriteLine(difference);
    }
}

Documentation

Utilities

DeepCompareExtensions

Provides methods to recursively compare objects for structural equality:

  • DeepEquals<T>: Deeply compares two objects, checking all properties, fields, and nested objects recursively.
  • TryDeepEquals<T>: Same as DeepEquals but uses a result object with detailed difference information instead of throwing exceptions.

Customizable comparison options include:

  • IgnoreCase: For case-insensitive string comparison
  • CompareCollectionsAsSet: Compare collections by content regardless of element order
  • FloatingPointTolerance: Set a tolerance for floating-point number comparisons
  • IgnoreMembers: Skip specific properties/fields during comparison
  • ContinueOnDifference: Collect all differences instead of stopping at the first one
  • TreatNullAndDefaultAsEqual: Consider null and default values (like 0 for int) as equal
DeepCloneExtensions

Creates deep copies of objects, including all nested objects:

  • DeepClone<T>: Creates a deep clone of an object
  • TryDeepClone<T>: Same as DeepClone but uses a result object with warnings instead of throwing exceptions

Provides options for controlling clone behavior including constructor handling and error recovery.

Contributing

Contributions are welcome! If you have ideas for new features or improvements, feel free to submit a pull request or open an issue.

License

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

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 is compatible.  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.
  • net9.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
9.0.0 259 4/9/2025
8.1.0 175 1/16/2025