Need help with DeepCopy?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

ReubenBond
142 Stars 17 Forks MIT License 24 Commits 5 Opened issues

Description

Simple & efficient library for deep copying .NET objects

Services available

!
?

Need anything else?

Contributors list

# 77,134
C#
.NET
Shell
multi-t...
6 commits
# 9,672
.NET
C#
F#
actor-m...
4 commits
# 127,384
C#
Univers...
Xamarin
c-sharp
1 commit
# 136,111
Shell
eureka
golang
C
1 commit
# 97,067
dotnets...
netfram...
cqrs-fr...
xamarin...
1 commit

DeepCopy

Simple & efficient library for deep copying .NET objects

Described in this blog post: https://reubenbond.github.io/posts/codegen-2-il-boogaloo

Installation:

Install via NuGet:

powershell
PM> Install-Package DeepCopy

Usage:

// Add a using directive for DeepCopy.
var poco = new Poco();
var original = new[] { poco, poco };

var result = DeepCopier.Copy(original);

// The result is a copy of the original. Assert.NotSame(original, result);

// Because both elements in the original array point to the same object, // both elements in the copied array also point to the same object. Assert.Same(result[0], result[1]);

Optionally, classes can be marked using the

[Immutable]
attribute to tell
DeepCopy
to skip copying them and return them unmodified. Object can also be wrapped in
Immutable
using
Immutable.Create(value)
.

The majority of this project was adapted from

dotnet/orleans
.

PR's welcome!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.