AnyDiff 1.0.0
See the version list below for details.
dotnet add package AnyDiff --version 1.0.0
NuGet\Install-Package AnyDiff -Version 1.0.0
<PackageReference Include="AnyDiff" Version="1.0.0" />
paket add AnyDiff --version 1.0.0
#r "nuget: AnyDiff, 1.0.0"
// Install AnyDiff as a Cake Addin #addin nuget:?package=AnyDiff&version=1.0.0 // Install AnyDiff as a Cake Tool #tool nuget:?package=AnyDiff&version=1.0.0
AnyDiff
A CSharp library that allows you to diff two objects and get a list of the differences back.
Description
AnyDiff works with complex objects of any type, and is great for performing changeset tracking, auditing, or anything else that might require comparing differences between complex objects. Great when combined with AnyClone, as it lets you take a snapshot of the current state of an object and then compare it in the future for changes to it.
It can even do this for objects that are of different types, though the results may vary depending on how different they are.
Usage
Comparing two objects with no differences:
var object1 = new MyComplexObject(1, "A string");
var object2 = new MyComplexObject(1, "A string");
var diff = AnyDiff.Diff(object1, object2);
Assert.AreEqual(diff.Count, 0);
Comparing two objects with a single expected change:
var object1 = new MyComplexObject(1, "A string");
var object2 = new MyComplexObject(1, "A different string");
var diff = AnyDiff.Diff(object1, object2);
Assert.AreEqual(diff.Count, 1);
Viewing the results of a diff:
var diff = AnyDiff.Diff(object1, object2);
var diff = AnyDiff.Diff(object1, object2);
foreach(var difference in diff)
{
Console.Write($"Index: {difference.ArrayIndex}"); // when array elements differ in value
Console.Write($"Delta: {difference.Delta}"); // when numbers, strings differ in value
Console.Write($"Left: {difference.LeftValue}"); // the left value being compared
Console.Write($"Right: {difference.RightValue}"); // the right value being compared
Console.Write($"Property name: {difference.Property}"); // the name of the field/property
Console.Write($"Property type: {difference.PropertyType}"); // the type of the field/property
}
Comparing the difference between the same object at different states, using AnyClone
// using AnyClone;
var object1 = new MyComplexObject(1, "A string");
var object1Snapshot = object1.Clone();
var diff = AnyDiff.Diff(object1, object1Snapshot);
Assert.AreEqual(diff.Count, 0);
// change something anywhere in the object tree
object1.Name = "A different string";
diff = AnyDiff.Diff(object1, object1Snapshot);
Assert.AreEqual(diff.Count, 1);
Product | Versions 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 12.0.1-beta1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on AnyDiff:
Package | Downloads |
---|---|
RF.Common
RabbitFoot Common |
|
IdOps.Server
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.99 | 35,235 | 6/21/2024 |
1.0.96 | 297 | 6/12/2024 |
1.0.91 | 15,741 | 4/3/2024 |
1.0.88 | 338,159 | 7/29/2021 |
1.0.86 | 477 | 7/29/2021 |
1.0.83 | 119,291 | 7/10/2020 |
1.0.82 | 632 | 7/10/2020 |
1.0.81 | 651 | 7/10/2020 |
1.0.80 | 652 | 7/10/2020 |
1.0.78 | 538 | 7/10/2020 |
1.0.73 | 4,703 | 5/23/2020 |
1.0.71 | 6,911 | 4/22/2020 |
1.0.68 | 534 | 4/20/2020 |
1.0.62 | 57,348 | 3/17/2020 |
1.0.61 | 3,684 | 11/22/2019 |
1.0.59 | 623 | 11/22/2019 |
1.0.56 | 20,597 | 5/23/2019 |
1.0.55 | 1,012 | 5/22/2019 |
1.0.54 | 993 | 5/22/2019 |
1.0.52 | 1,027 | 5/22/2019 |
1.0.51 | 980 | 5/22/2019 |
1.0.50 | 1,019 | 5/21/2019 |
1.0.48 | 1,023 | 5/21/2019 |
1.0.47 | 1,022 | 5/16/2019 |
1.0.45 | 1,443 | 4/20/2019 |
1.0.38 | 2,733 | 1/11/2019 |
1.0.37 | 39,239 | 1/7/2019 |
1.0.34 | 1,158 | 12/28/2018 |
1.0.25 | 1,437 | 12/4/2018 |
1.0.23 | 1,147 | 12/2/2018 |
1.0.22 | 1,211 | 12/2/2018 |
1.0.20 | 1,766 | 12/2/2018 |
1.0.8 | 1,168 | 12/1/2018 |
1.0.7 | 1,169 | 11/30/2018 |
1.0.5 | 1,135 | 11/29/2018 |
1.0.4 | 1,196 | 11/28/2018 |
1.0.0 | 1,371 | 11/16/2018 |
A CSharp library that allows you to diff two objects and get a list of the differences back.