ComparableLibrary 1.1.0
See the version list below for details.
dotnet add package ComparableLibrary --version 1.1.0
NuGet\Install-Package ComparableLibrary -Version 1.1.0
<PackageReference Include="ComparableLibrary" Version="1.1.0" />
<PackageVersion Include="ComparableLibrary" Version="1.1.0" />
<PackageReference Include="ComparableLibrary" />
paket add ComparableLibrary --version 1.1.0
#r "nuget: ComparableLibrary, 1.1.0"
#:package ComparableLibrary@1.1.0
#addin nuget:?package=ComparableLibrary&version=1.1.0
#tool nuget:?package=ComparableLibrary&version=1.1.0
ComparableSolution
This solution was created to demonstrate how to compare two objects by value. For this was created interface IGeneralComparable which provides a way to generate a hash from significant fields allowing objects to be compared using this hash.
The project was implemented in C# using the System.Data.HashFunction.MurmurHash NuGet package for hashing with the MurmurHash3 algorithm.
Instalation
dotnet add package ComparableLibrary --version 1.1.0
Features
The Interface IGeneralComparable provides an opportunity to compare multiple objects by generating a hash from significant fields. To generate a hash, your classes need to inherit from IGeneralComparable and mark properties that need to be compared using the ComparablePropertyAttribute. ComparablePropertyAttribute properties:
- Name - Needs to be set to compare objects of different types (default: uses the name of the property).
- Order - Defines the sequence number for ordering properties in multiple classes to ensure they are processed in the same order. Properties with this attribute are processed first, followed by those without it.
- Type - Used only for collections. It distinguishes between ordered and unordered collections, and the hash structure differs accordingly.
And exist general class GeneralComparable which has property for saving hash HashSum.
For using it to inherit your class for interface IGeneralComparable and set attribute for properties which impotant for calculate hash.
See more GitHub
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net9.0
- System.Data.HashFunction.MurmurHash (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.