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
<PackageReference Include="Tildom.Extensions" Version="9.0.0" />
<PackageVersion Include="Tildom.Extensions" Version="9.0.0" />
<PackageReference Include="Tildom.Extensions" />
paket add Tildom.Extensions --version 9.0.0
#r "nuget: Tildom.Extensions, 9.0.0"
#:package Tildom.Extensions@9.0.0
#addin nuget:?package=Tildom.Extensions&version=9.0.0
#tool nuget:?package=Tildom.Extensions&version=9.0.0
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 | Versions 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. |
-
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.