Mastronardi.Utils.Comparing
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Mastronardi.Utils.Comparing --version 1.0.0
NuGet\Install-Package Mastronardi.Utils.Comparing -Version 1.0.0
<PackageReference Include="Mastronardi.Utils.Comparing" Version="1.0.0" />
paket add Mastronardi.Utils.Comparing --version 1.0.0
#r "nuget: Mastronardi.Utils.Comparing, 1.0.0"
// Install Mastronardi.Utils.Comparing as a Cake Addin #addin nuget:?package=Mastronardi.Utils.Comparing&version=1.0.0 // Install Mastronardi.Utils.Comparing as a Cake Tool #tool nuget:?package=Mastronardi.Utils.Comparing&version=1.0.0
Comparing Utilities
We can compare strings based on the Levenshtein Distance and hash any object to compare the hash.
Levenshtein Distance
int result = LevenshteinDistance.Compute(string1, string2, caseSensitive);
This returns the number of changes needed to make the strings identical... This uses the Levenshtein Distance algorithm
int percentage = LevenshteinDistance.ComputePercentage(string1, string2, caseSensitive);
This returns the percentage of the string how far it deviates from one another.
Both exist also as extension methods:
using Mastronardi.Utils;
int result = string1.ComputeDistance(string2);
int percentage = string1.ComputeDistancePercentage(string2);
Object hashes
To compare 2 objects, to see if their content is identical, you can use these hashes. (also ideal as a key for a dictionary)
string base64md5hash = myObj.GetMD5Hash();
string base64shaHash = myObj.GetSHA1Hash();
It is also possible to used keyed hashes:
string base64md5hash = myObj.GetKeyedHash<YourKeyedHashAlgorithm>();
If you need more info on how this works you can go here: https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.keyedhashalgorithm?view=netcore-3.1
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
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.