Skip to content

Commit

Permalink
Merge branch 'next' of https://github.com/lofcz/FastCloner into next
Browse files Browse the repository at this point in the history
  • Loading branch information
lofcz committed Jan 8, 2025
2 parents c6059ba + 7c283d2 commit fc76670
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ var clone = FastCloner.DeepClone(new { Hello = "world", MyList = new List<int> {

## Advanced usage

Appart from deep cloning, FastCloner supports shallow cloning and deep cloning _to_ target:
Sometimes you might want to exclude certain fields & properties from cloning:
```csharp
private class TestPropsWithIgnored
{
public int A { get; set; } = 10;
[DeepCloneIgnore] // <-- decorate such members with [DeepCloneIgnore]
public string B { get; set; } = "My string";
}

TestPropsWithIgnored original = new TestPropsWithIgnored { A = 42, B = "Test value" };
TestPropsWithIgnored clone = original.DeepClone(); // clone.B is null (default value of a given type)
```

Apart from deep cloning, FastCloner supports shallow cloning and deep cloning _to_ target:

```csharp
// the list is shared between the two instances
Expand Down

0 comments on commit fc76670

Please sign in to comment.