DifferenceUtility.Net 1.0.1.5-alpha

This is a prerelease version of DifferenceUtility.Net.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DifferenceUtility.Net --version 1.0.1.5-alpha                
NuGet\Install-Package DifferenceUtility.Net -Version 1.0.1.5-alpha                
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.5-alpha" />                
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.5-alpha                
#r "nuget: DifferenceUtility.Net, 1.0.1.5-alpha"                
#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.5-alpha&prerelease

// Install DifferenceUtility.Net as a Cake Tool
#tool nuget:?package=DifferenceUtility.Net&version=1.0.1.5-alpha&prerelease                

<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 455 5/9/2022
1.0.1.9-alpha 165 5/7/2022
1.0.1.5 416 5/5/2022
1.0.1.5-alpha 176 3/21/2022
1.0.1.4 439 3/16/2022
1.0.1.4-alpha 195 3/16/2022
1.0.1.3-alpha 160 3/13/2022
1.0.1 429 3/12/2022
1.0.0.8-alpha 156 3/12/2022
1.0.0 454 1/25/2022
1.0.0-alpha-d84cf33 184 1/25/2022
1.0.0-alpha-c273645 175 1/25/2022
1.0.0-alpha-8a1e33e 189 1/25/2022
1.0.0-alpha-4515657 178 1/25/2022
1.0.0-alpha-37ad425 172 1/25/2022
0.1.2-alpha-9618ec1 206 12/21/2021
0.1.1-alpha-ff0534b 211 12/17/2021
0.1.1-alpha-f52866d 177 12/7/2021
0.1.1-alpha-e5ffc2f 207 12/14/2021
0.1.1-alpha-cd8a2fa 208 12/18/2021
0.1.1-alpha-4eba9e6 1,278 11/26/2021
0.1.1-alpha-223c71e 169 12/15/2021
0.1.1-alpha-1a52911 191 12/11/2021
0.1.1-alpha-14ce4df 207 12/18/2021
0.1.1-alpha-0afd709 212 12/15/2021
0.1.0-alpha-2d57c7b 228 10/22/2021