Skip to content

Commit f5f0ba4

Browse files
committed
Update README.md
1 parent 8f1b513 commit f5f0ba4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ TreeNode clone = child.DeepClone();
108108

109109
This differs from `[FastClonerIgnore]` which leaves the member as `null`/default. With `[FastClonerShallow]`, the original reference is preserved.
110110

111-
You might also need to customize how certain types are handled globally. Use `FastCloner.FastCloner.SetTypeBehavior<T>` to configure specific behaviors.
111+
### Customizing Reflection Cloning
112+
113+
Use `FastCloner.FastCloner.SetTypeBehavior<T>` to configure how specific types are cloned globally.
112114

113115
```csharp
114116
FastCloner.FastCloner.SetTypeBehavior<MySingletonService>(CloneBehavior.Skip);
@@ -120,13 +122,13 @@ Available behaviors:
120122
* `Shallow`: Top-level `MemberwiseClone`.
121123
* `Skip`: Return `default`, skip cloning.
122124

123-
To reset behavior:
125+
To reset a behavior:
124126
```csharp
125127
FastCloner.FastCloner.ClearTypeBehavior<MySingletonService>();
126128
FastCloner.FastCloner.ClearAllTypeBehaviors();
127129
```
128130

129-
>*Note: Changing type behavior automatically invalidates the internal cache, which may temporarily impact performance. Configure this at application startup.*
131+
>*Note: Changing type behavior at runtime automatically invalidates the internal cache, which may temporarily impact performance. Try to configure behaviors once, at application startup.*
130132
131133
Cache can be invalidated to reduce the memory footprint, if needed:
132134

0 commit comments

Comments
 (0)