PhotoAtomic.Clooney 0.6.0

dotnet add package PhotoAtomic.Clooney --version 0.6.0
                    
NuGet\Install-Package PhotoAtomic.Clooney -Version 0.6.0
                    
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="PhotoAtomic.Clooney" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PhotoAtomic.Clooney" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="PhotoAtomic.Clooney" />
                    
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 PhotoAtomic.Clooney --version 0.6.0
                    
#r "nuget: PhotoAtomic.Clooney, 0.6.0"
                    
#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 PhotoAtomic.Clooney@0.6.0
                    
#: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=PhotoAtomic.Clooney&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=PhotoAtomic.Clooney&version=0.6.0
                    
Install as a Cake Tool

PhotoAtomic.Clooney

Roslyn source generators for deep clone, structural diff and structural hash of your object graphs — cycle-safe, with zero reflection at runtime: everything is generated at compile time.

using PhotoAtomic.Clooney;

[Clonable]
[Diffable]
[Hashable]
public class BankAccountState
{
    public decimal Balance { get; set; }
    public int TransactionCount { get; set; }

    [SkipClone]
    public List<Event> PendingEvents { get; set; } = new();
}
var clone = state.Clone();              // deep copy, [SkipClone] members excluded
var diffs = state.Diff(otherState);     // IEnumerable<DifferencePath>: where two graphs diverge
var hash  = state.HashValue();          // structural hash of the whole graph

The three generators

Attribute Generates Excludes with
[Clonable] Clone() and Clone(CloneContext) extension methods — deep copy; the context tracks references so shared and cyclic instances clone once. [SkipClone]
[Diffable] Diff(other) returning DifferencePath items, each a root→leaf chain of nodes pointing at the exact property (or collection slot) that diverges, with current/other values. [SkipDiff]
[Hashable] HashValue() — structural hash over the graph, cycle-safe via HashContext. [SkipHash]

Inheritance, interfaces and polymorphic hierarchies are supported: derived types get their own generated methods, and interface-typed properties dispatch to the runtime type.

Installing

dotnet add package PhotoAtomic.Clooney

The package is an analyzer: it runs inside the compiler and adds no runtime dependency except PhotoAtomic.Clooney.Abstractions (brought in automatically), which contains the attributes, the interfaces and the clone/diff/hash contexts your compiled code uses.

Part of PhotoAtomic.Libraries.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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
0.6.0 43 8/23/2026
0.5.0 99 8/16/2026
0.4.0 86 8/16/2026
0.3.0 88 8/15/2026
0.2.1 88 8/12/2026
0.2.0 84 8/12/2026
0.1.0 84 8/12/2026