DifferenceUtility.Net 1.0.0-alpha-d84cf33

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.0-alpha-d84cf33
                    
NuGet\Install-Package DifferenceUtility.Net -Version 1.0.0-alpha-d84cf33
                    
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.0-alpha-d84cf33" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DifferenceUtility.Net" Version="1.0.0-alpha-d84cf33" />
                    
Directory.Packages.props
<PackageReference Include="DifferenceUtility.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DifferenceUtility.Net --version 1.0.0-alpha-d84cf33
                    
#r "nuget: DifferenceUtility.Net, 1.0.0-alpha-d84cf33"
                    
#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.
#:package DifferenceUtility.Net@1.0.0-alpha-d84cf33
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DifferenceUtility.Net&version=1.0.0-alpha-d84cf33&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DifferenceUtility.Net&version=1.0.0-alpha-d84cf33&prerelease
                    
Install as a Cake Tool

<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 was computed.  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.  net9.0 was computed.  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. 
.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.

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 558 5/9/2022
1.0.1.9-alpha 242 5/7/2022
1.0.1.5 493 5/5/2022
1.0.1.5-alpha 257 3/21/2022
1.0.1.4 527 3/16/2022
1.0.1.4-alpha 277 3/16/2022
1.0.1.3-alpha 242 3/13/2022
1.0.1 515 3/12/2022
1.0.0.8-alpha 244 3/12/2022
1.0.0 534 1/25/2022
1.0.0-alpha-d84cf33 268 1/25/2022
1.0.0-alpha-c273645 255 1/25/2022
1.0.0-alpha-8a1e33e 272 1/25/2022
1.0.0-alpha-4515657 262 1/25/2022
1.0.0-alpha-37ad425 250 1/25/2022
0.1.2-alpha-9618ec1 287 12/21/2021
0.1.1-alpha-ff0534b 290 12/17/2021
0.1.1-alpha-f52866d 258 12/7/2021
0.1.1-alpha-e5ffc2f 286 12/14/2021
0.1.1-alpha-cd8a2fa 289 12/18/2021
0.1.1-alpha-4eba9e6 1,356 11/26/2021
0.1.1-alpha-223c71e 254 12/15/2021
0.1.1-alpha-1a52911 272 12/11/2021
0.1.1-alpha-14ce4df 288 12/18/2021
0.1.1-alpha-0afd709 292 12/15/2021
0.1.0-alpha-2d57c7b 310 10/22/2021