DifferenceUtility.Net 1.0.1.9

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

// Install DifferenceUtility.Net as a Cake Tool
#tool nuget:?package=DifferenceUtility.Net&version=1.0.1.9                

<div align="center">

<img src="assets/logo.png" width="50%" height="50%">

License: Apache GitHub forks lewisbennett

</div>

DifferenceUtility.Net

DifferenceUtility.Net is a library for .NET that handles the calculation and dispatch of the shortest possible path to convert one collection to another, resulting in a quick and smooth transition.

The library uses Eugene W. Myers' diff algorithm to calculate the difference between two collections (see docs). It also has an optional extra layer for calculating moves for items that are persistant between the two collections, but might be in different positions.

Getting Started

Diff Callback

Start by creating the diff callback for your chosen data type by implementing IDiffCallback. Alternatively, you can extend BaseDiffCallback depending on the use case. Examples of various implementations can be found within the sample projects.

Calculate Diff

Call DiffUtil.CalculateDiff to calculate the difference between your two collections. The source collection, destination collection, and diff callback for the same data type must be provided. You can optionally disable move detection via the detectMoves parameter. This is recommended if your data is sorted by the same constraint (for example: date/time order), or whenever you know there won't be any moves that need to be made.

Depending on the size of your collections, it is recommended to calculate the difference on a background thread, then dispatch them on the main thread. This is especially recommended for UI applictions so not to block the main thread.

Dispatching the Changes

Calling DiffUtil.CalculateDiff will return a DiffResult object which contains the necessary instructions to convert the source collection into the destination collection. Call DiffResult.DispatchUpdatesTo and provide either an ObservableCollection or an ICollectionUpdateCallback to receive the changes.

Sample Projects

Benchmarking

The project can be benchmarked using simple data within the benchmarking project.

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.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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.1.9 442 5/9/2022
1.0.1.9-alpha 161 5/7/2022
1.0.1.5 410 5/5/2022
1.0.1.5-alpha 170 3/21/2022
1.0.1.4 431 3/16/2022
1.0.1.4-alpha 189 3/16/2022
1.0.1.3-alpha 156 3/13/2022
1.0.1 423 3/12/2022
1.0.0.8-alpha 152 3/12/2022
1.0.0 448 1/25/2022
1.0.0-alpha-d84cf33 178 1/25/2022
1.0.0-alpha-c273645 169 1/25/2022
1.0.0-alpha-8a1e33e 183 1/25/2022
1.0.0-alpha-4515657 172 1/25/2022
1.0.0-alpha-37ad425 168 1/25/2022
0.1.2-alpha-9618ec1 202 12/21/2021
0.1.1-alpha-ff0534b 207 12/17/2021
0.1.1-alpha-f52866d 173 12/7/2021
0.1.1-alpha-e5ffc2f 203 12/14/2021
0.1.1-alpha-cd8a2fa 204 12/18/2021
0.1.1-alpha-4eba9e6 1,274 11/26/2021
0.1.1-alpha-223c71e 165 12/15/2021
0.1.1-alpha-1a52911 187 12/11/2021
0.1.1-alpha-14ce4df 203 12/18/2021
0.1.1-alpha-0afd709 206 12/15/2021
0.1.0-alpha-2d57c7b 224 10/22/2021