CommonNetFuncs.DeepClone 3.7.0

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

CommonNetFuncs.DeepClone

nuget

This project contains helper methods for deep cloning objects in .NET applications (i.e. creating a new instance of an object with the same values as an existing instance but without the same references in memory).

Contents


ExpressionTrees

Use expression trees to deep clone objects. This is by far the fastest of the three deep clone methods in this package with a minor penalty for the first clone of each unique type to construct the expression tree.

ExpressionTrees Usage Examples

<details> <summary><h3>Usage Examples</h3></summary>

DeepClone

Deep clone an object using expression trees.

public class Person
{
  public string Name { get; set; }
  public int Age { get; set; }
}

Person original = new() { Name = "Chris", Age = "34" };
Person clone = original.DeepClone();
clone.Name = "Nick"; // Clone's Name property == "Nick" while original's Name property remains "Chris"

</details>


Reflection

Use reflection to deep clone objects. In most cases this is the second fastest option of the three deep clone methods in this package.

Reflection Usage Examples

<details> <summary><h3>Usage Examples</h3></summary>

DeepCloneR

Deep clone an object using reflection.

public class Person
{
  public string Name { get; set; }
  public int Age { get; set; }
}

Person original = new() { Name = "Chris", Age = "34" };
Person clone = original.DeepCloneR();
clone.Name = "Nick"; // Clone's Name property == "Nick" while original's Name property remains "Chris"

</details>


Serialize

Use JSON serialization to deep clone objects. In most cases this is the slowest option of the three deep clone methods in this package.

Serialize Usage Examples

<details> <summary><h3>Usage Examples</h3></summary>

DeepCloneS

Deep clone an object using JSON serialization.

public class Person
{
  public string Name { get; set; }
  public int Age { get; set; }
}

Person original = new() { Name = "Chris", Age = "34" };
Person clone = original.DeepCloneS();
clone.Name = "Nick"; // Clone's Name property == "Nick" while original's Name property remains "Chris"

</details>

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CommonNetFuncs.DeepClone:

Package Downloads
CommonNetFuncs.Web.Api

Generic API endpoints for use in an ASP.NET API

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.7.0 120 8/18/2025
3.6.27 112 8/18/2025
3.6.26 123 8/14/2025
3.6.25 140 8/13/2025
3.6.24 139 8/12/2025
3.6.19 110 7/28/2025
3.6.18 324 7/25/2025
3.6.1 146 7/14/2025
3.6.0 106 7/11/2025
3.5.3 144 7/10/2025
3.5.0 149 7/7/2025
3.4.30 127 7/7/2025
3.4.23 156 6/26/2025
3.4.21 144 6/26/2025
3.4.20 158 6/25/2025
3.4.8 357 6/11/2025
3.4.2 166 6/2/2025
3.4.1 102 5/30/2025
3.4.0 112 5/30/2025
3.3.11 155 5/19/2025
3.3.10 278 5/13/2025
3.3.0 193 4/29/2025
3.2.22 293 3/12/2025
3.2.13 206 2/13/2025
3.2.0 186 12/19/2024
3.1.0 200 12/6/2024
3.0.0 150 12/3/2024
2.1.3 136 12/3/2024
2.1.0 139 12/2/2024
2.0.5 132 11/26/2024
2.0.2 143 11/18/2024
2.0.1 123 11/15/2024
2.0.0 134 11/14/2024
1.0.47 148 11/14/2024
1.0.42 167 11/12/2024
1.0.40 152 11/12/2024
1.0.37 167 11/4/2024
1.0.31 159 10/31/2024
1.0.28 160 10/25/2024
1.0.26 184 10/18/2024
1.0.25 134 10/17/2024
1.0.24 115 10/17/2024
1.0.18 152 10/11/2024
1.0.17 172 9/27/2024
1.0.16 139 9/27/2024
1.0.14 152 9/23/2024
1.0.13 147 9/18/2024
1.0.12 138 9/18/2024
1.0.11 143 9/18/2024
1.0.10 188 9/11/2024
1.0.9 182 9/11/2024
1.0.8 172 9/11/2024
1.0.7 182 9/11/2024
1.0.1 179 9/4/2024
1.0.0 170 9/2/2024