MintPlayer.ValueComparers.NewtonsoftJson
12.2.0
See the version list below for details.
dotnet add package MintPlayer.ValueComparers.NewtonsoftJson --version 12.2.0
NuGet\Install-Package MintPlayer.ValueComparers.NewtonsoftJson -Version 12.2.0
<PackageReference Include="MintPlayer.ValueComparers.NewtonsoftJson" Version="12.2.0" />
<PackageVersion Include="MintPlayer.ValueComparers.NewtonsoftJson" Version="12.2.0" />
<PackageReference Include="MintPlayer.ValueComparers.NewtonsoftJson" />
paket add MintPlayer.ValueComparers.NewtonsoftJson --version 12.2.0
#r "nuget: MintPlayer.ValueComparers.NewtonsoftJson, 12.2.0"
#:package MintPlayer.ValueComparers.NewtonsoftJson@12.2.0
#addin nuget:?package=MintPlayer.ValueComparers.NewtonsoftJson&version=12.2.0
#tool nuget:?package=MintPlayer.ValueComparers.NewtonsoftJson&version=12.2.0
MintPlayer.ValueComparers.NewtonsoftJson
An IEqualityComparer<JObject> for Newtonsoft.Json.Linq.JObject, for use in incremental source generators.
Why this exists
An incremental generator only skips work when it can tell that its inputs are unchanged, and it
decides that with EqualityComparer<T>.Default. JObject compares by reference, so a model carrying one
looks different on every single run — the generator re-runs, and the caching that makes
incremental generators fast is silently lost.
JObjectValueComparer compares two JObjects by their compact serialized form (ordinal), so equal JSON
compares equal, and hashes that same form so equal objects hash equally. Property order is significant,
because the serialized form preserves it.
Usage
Put [UseEqualityComparer] on the JObject property of an
[GenerateEquality]
model:
using MintPlayer.ValueComparerGenerator.Attributes;
using MintPlayer.ValueComparers.NewtonsoftJson;
using Newtonsoft.Json.Linq;
[GenerateEquality]
public partial class ConfigModel
{
public string Name { get; set; } = string.Empty;
[UseEqualityComparer(typeof(JObjectValueComparer))]
public JObject? Settings { get; set; }
}
The generated Equals/GetHashCode call JObjectValueComparer.Instance for that property. Nothing needs
to be registered.
It is a plain IEqualityComparer<JObject?>, so it also works anywhere else a comparer is accepted:
new HashSet<JObject?>(JObjectValueComparer.Instance), a dictionary, or as the element comparer of
ValueEquality.List(a, b, JObjectValueComparer.Instance).
Breaking changes in 12.0.0
The full list, with a migration guide, is in the changelog.
JObjectValueComparerno longer derives fromValueComparer<JObject>(which is deleted from MintPlayer.SourceGenerators.Tools). It is a sealedIEqualityComparer<JObject?>with a staticInstance.JObjectValueComparer.Register()is gone, together with the registry it registered into. Replace the module initializer that called it with[UseEqualityComparer(typeof(JObjectValueComparer))]on eachJObjectproperty.- The package no longer depends on MintPlayer.SourceGenerators.Tools.
Related packages
- MintPlayer.ValueComparerGenerator — generates value equality for your own model types
- MintPlayer.SourceGenerators.Tools —
ValueEqualityandEquatableArray<T>
| 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. 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 | 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 (>= 13.0.4)
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 | |
|---|---|---|---|
| 13.0.0 | 42 | 10/11/2026 | |
| 12.2.0 | 48 | 10/11/2026 | |
| 12.1.1 | 90 | 10/2/2026 | |
| 12.1.0 | 107 | 9/26/2026 | |
| 12.0.1 | 114 | 9/25/2026 | |
| 12.0.0 | 111 | 9/25/2026 | |
| 11.0.0 | 152 | 9/25/2026 | |
| 10.20.2 | 498 | 8/27/2026 | |
| 10.20.1 | 130 | 8/27/2026 | |
| 10.20.0 | 836 | 6/5/2026 | |
| 10.19.0 | 936 | 4/3/2026 | |
| 10.13.0 | 1,307 | 1/19/2026 | |
| 10.10.1 | 298 | 1/12/2026 | |
| 10.10.0 | 187 | 1/12/2026 | |
| 10.9.0 | 182 | 1/12/2026 | |
| 10.8.0 | 259 | 12/24/2025 | |
| 10.7.0 | 376 | 11/13/2025 | |
| 10.5.0 | 532 | 11/11/2025 | |
| 10.4.0 | 354 | 11/10/2025 | |
| 10.3.0 | 295 | 11/6/2025 |