Skip to content

Commit 7c283d2

Browse files
authored
Update README.md
1 parent 15d994f commit 7c283d2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,20 @@ var clone = FastCloner.DeepClone(new { Hello = "world", MyList = new List<int> {
2525

2626
## Advanced usage
2727

28-
Appart from deep cloning, FastCloner supports shallow cloning and deep cloning _to_ target:
28+
Sometimes you might want to exclude certain fields & properties from cloning:
29+
```csharp
30+
private class TestPropsWithIgnored
31+
{
32+
public int A { get; set; } = 10;
33+
[DeepCloneIgnore] // <-- decorate such members with [DeepCloneIgnore]
34+
public string B { get; set; } = "My string";
35+
}
36+
37+
TestPropsWithIgnored original = new TestPropsWithIgnored { A = 42, B = "Test value" };
38+
TestPropsWithIgnored clone = original.DeepClone(); // clone.B is null (default value of a given type)
39+
```
40+
41+
Apart from deep cloning, FastCloner supports shallow cloning and deep cloning _to_ target:
2942

3043
```csharp
3144
// the list is shared between the two instances

0 commit comments

Comments
 (0)