├── src
└── DeepCopy
│ ├── DeepCopyDelegate.cs
│ ├── ImmutableAttribute.cs
│ ├── ReferenceEqualsComparer.cs
│ ├── Immutable.cs
│ ├── CopyContext.cs
│ ├── DeepCopier.cs
│ ├── DeepCopy.csproj
│ ├── MethodInfos.cs
│ ├── ArrayCopier.cs
│ ├── CopierGenerator.cs
│ └── CopyPolicy.cs
├── test
├── DeepCopy.Benchmarks
│ ├── DeepCopy.Benchmarks.csproj
│ ├── Program.cs
│ └── GetCloneBenchmarks.cs
└── DeepCopy.UnitTests
│ ├── DeepCopy.UnitTests.csproj
│ ├── BenchmarkTests.cs
│ └── CopyTests.cs
├── README.md
├── LICENSE
├── .gitattributes
├── DeepCopy.sln
└── .gitignore
/src/DeepCopy/DeepCopyDelegate.cs:
--------------------------------------------------------------------------------
1 | namespace DeepCopy
2 | {
3 | ///
4 | /// Deep copier delegate.
5 | ///
6 | /// Original object to be deep copied.
7 | /// The context.
8 | /// Deep copy of the original object.
9 | internal delegate T DeepCopyDelegate(T original, CopyContext context);
10 | }
--------------------------------------------------------------------------------
/test/DeepCopy.Benchmarks/DeepCopy.Benchmarks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp2.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/DeepCopy/ImmutableAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DeepCopy
4 | {
5 | ///
6 | /// The Immutable attribute indicates that instances of the marked class or struct are never modified
7 | /// after they are created.
8 | ///
9 | ///
10 | /// Note that this implies that sub-objects are also not modified after the instance is created.
11 | ///
12 | [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class)]
13 | public sealed class ImmutableAttribute : Attribute
14 | {
15 | }
16 | }
--------------------------------------------------------------------------------
/test/DeepCopy.UnitTests/DeepCopy.UnitTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/DeepCopy/ReferenceEqualsComparer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Runtime.CompilerServices;
3 |
4 | namespace DeepCopy
5 | {
6 | ///
7 | internal sealed class ReferenceEqualsComparer : IEqualityComparer