CommonNetFuncs.DeepClone 3.5.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package CommonNetFuncs.DeepClone --version 3.5.3
                    
NuGet\Install-Package CommonNetFuncs.DeepClone -Version 3.5.3
                    
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.5.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommonNetFuncs.DeepClone" Version="3.5.3" />
                    
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.5.3
                    
#r "nuget: CommonNetFuncs.DeepClone, 3.5.3"
                    
#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.5.3
                    
#: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.5.3
                    
Install as a Cake Addin
#tool nuget:?package=CommonNetFuncs.DeepClone&version=3.5.3
                    
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.
  • net9.0

    • No dependencies.

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 85 8/18/2025
3.6.27 84 8/18/2025
3.6.26 92 8/14/2025
3.6.25 96 8/13/2025
3.6.24 119 8/12/2025
3.6.19 105 7/28/2025
3.6.18 322 7/25/2025
3.6.1 145 7/14/2025
3.6.0 96 7/11/2025
3.5.3 143 7/10/2025
3.5.0 148 7/7/2025
3.4.30 126 7/7/2025
3.4.23 155 6/26/2025
3.4.21 143 6/26/2025
3.4.20 157 6/25/2025
3.4.8 356 6/11/2025
3.4.2 165 6/2/2025
3.4.1 100 5/30/2025
3.4.0 111 5/30/2025
3.3.11 154 5/19/2025
3.3.10 276 5/13/2025
3.3.0 192 4/29/2025
3.2.22 292 3/12/2025
3.2.13 205 2/13/2025
3.2.0 185 12/19/2024
3.1.0 199 12/6/2024
3.0.0 149 12/3/2024
2.1.3 135 12/3/2024
2.1.0 138 12/2/2024
2.0.5 131 11/26/2024
2.0.2 142 11/18/2024
2.0.1 122 11/15/2024
2.0.0 133 11/14/2024
1.0.47 147 11/14/2024
1.0.42 166 11/12/2024
1.0.40 151 11/12/2024
1.0.37 166 11/4/2024
1.0.31 158 10/31/2024
1.0.28 159 10/25/2024
1.0.26 183 10/18/2024
1.0.25 133 10/17/2024
1.0.24 114 10/17/2024
1.0.18 151 10/11/2024
1.0.17 171 9/27/2024
1.0.16 138 9/27/2024
1.0.14 151 9/23/2024
1.0.13 146 9/18/2024
1.0.12 137 9/18/2024
1.0.11 142 9/18/2024
1.0.10 187 9/11/2024
1.0.9 181 9/11/2024
1.0.8 171 9/11/2024
1.0.7 181 9/11/2024
1.0.1 178 9/4/2024
1.0.0 169 9/2/2024