Mastronardi.Utils.Comparing 1.0.2

Prefix Reserved
dotnet add package Mastronardi.Utils.Comparing --version 1.0.2                
NuGet\Install-Package Mastronardi.Utils.Comparing -Version 1.0.2                
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="Mastronardi.Utils.Comparing" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mastronardi.Utils.Comparing --version 1.0.2                
#r "nuget: Mastronardi.Utils.Comparing, 1.0.2"                
#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.
// Install Mastronardi.Utils.Comparing as a Cake Addin
#addin nuget:?package=Mastronardi.Utils.Comparing&version=1.0.2

// Install Mastronardi.Utils.Comparing as a Cake Tool
#tool nuget:?package=Mastronardi.Utils.Comparing&version=1.0.2                

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last updated
1.0.2 245 10/10/2022
1.0.0 148 8/28/2023