Skip to content

A small and efficient library that can deep copy object by Expression Tree

License

Notifications You must be signed in to change notification settings

eventhorizon-cli/DeepCopier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeepCopier

DeepCopier is a small library that can deep copy object by Expression Tree.

Installation:

Install DeepCopier NuGet package.

Usage Examples:

1.Deep copy the source object.

SomeType obj1 = new SomeType();
SomeType obj2 = Copier.Copy(obj1);

List<SomeType> list1 = new List<SomeType>{ obj1 };
List<SomeType> list2 = Copier.Copy(list1);

2.Create a new instance of the target type, and deep copy the property values of the given source object into the target instance.

/* The source and target classes do not have to match or even be derived
   from each other, as long as the properties match. */
SomeType obj1 = new SomeType();
AnotherType obj2 = Copier.Copy<SomeType, AnotherType>(obj1);

3.Copy the property values of the given source object into an existing target object.

/* The source and target classes do not have to match or even be derived
   from each other, as long as the properties match. */
SomeType obj1 = new SomeType();
AnotherType obj2 = new AnotherType();
Copier.Copy(obj1, obj2);

About

A small and efficient library that can deep copy object by Expression Tree

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages