Skip to content

Commit f42440e

Browse files
committed
Deploying to gh-pages from @ c77be4c 🚀
1 parent 19eb870 commit f42440e

23 files changed

+1109
-294
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ <h2><a name="Serialization" class="anchor" href="#Serialization">Serialization</
199199
<div class="fsdocs-tip" id="fs1">Multiple items<br />namespace DynamicObj<br /><br />--------------------<br />type DynamicObj =
200200
inherit DynamicObject
201201
new: unit -&gt; DynamicObj
202-
member DeepCopyProperties: unit -&gt; obj
203-
member DeepCopyPropertiesTo: target: #DynamicObj * ?overWrite: bool -&gt; unit
202+
member DeepCopyProperties: ?includeInstanceProperties: bool -&gt; obj
203+
member DeepCopyPropertiesTo: target: #DynamicObj * ?overWrite: bool * ?includeInstanceProperties: bool -&gt; unit
204204
override Equals: o: obj -&gt; bool
205205
override GetDynamicMemberNames: unit -&gt; IEnumerable&lt;string&gt;
206206
override GetHashCode: unit -&gt; int

index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

reference/dynamicobj-copyutils.html

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,19 @@ <h3>
143143
<tr>
144144
<td class="fsdocs-member-usage">
145145
<div>
146-
<code onmouseout="hideTip(event, '102', 102)" onmouseover="showTip(event, '102', 102)">
146+
<code onmouseout="hideTip(event, '106', 106)" onmouseover="showTip(event, '106', 106)">
147147
<p>
148148
<a id="tryDeepCopyObj">
149149
<a href="#tryDeepCopyObj">
150-
<code><span>CopyUtils.tryDeepCopyObj&#32;<span>o</span></span></code>
150+
<code><span>CopyUtils.tryDeepCopyObj&#32;<span><span>(<span>o,&#32;?includeInstanceProperties</span>)</span></span></span></code>
151151
</a>
152152
</a>
153153
</p>
154154
</code>
155-
<div class="fsdocs-tip" id="102">
155+
<div class="fsdocs-tip" id="106">
156156
<div class="member-tooltip">
157157
Full Usage:
158-
<code><span>CopyUtils.tryDeepCopyObj&#32;<span>o</span></span></code>
158+
<code><span>CopyUtils.tryDeepCopyObj&#32;<span><span>(<span>o,&#32;?includeInstanceProperties</span>)</span></span></span></code>
159159
<br/>
160160
<br/>
161161
Parameters:
@@ -166,6 +166,18 @@ <h3>
166166
</b>
167167
:
168168
<code>obj</code>
169+
-
170+
The object that should be deep copied
171+
</span>
172+
<br/>
173+
<span>
174+
<b>
175+
?includeInstanceProperties
176+
</b>
177+
:
178+
<code>bool</code>
179+
-
180+
Whether to include instance properties (= 'static' properties on the class) as dynamic properties on the new instance for matched DynamicObj. Default is true
169181
</span>
170182
<br/>
171183
</ul>
@@ -189,11 +201,34 @@ <h3>
189201
<div class="fsdocs-source-link" title="Copy signature (XML)" onclick="Clipboard_CopyTo('<see cref=\'M:DynamicObj.CopyUtils.tryDeepCopyObj\'/>')">
190202
<iconify-icon icon="bi:filetype-xml" height="24" width="24"></iconify-icon>
191203
</div>
192-
<a href="https://github.com/CSBiology/DynamicObj/tree/master/src/DynamicObj/DynamicObj.fs#L392-392" class="fsdocs-source-link" title="Source on GitHub">
204+
<a href="https://github.com/CSBiology/DynamicObj/tree/master/src/DynamicObj/DynamicObj.fs#L432-432" class="fsdocs-source-link" title="Source on GitHub">
193205
<iconify-icon icon="ri:github-fill" height="24" width="24"></iconify-icon>
194206
</a>
195207
<p class="fsdocs-summary">
196-
internal helper function to deep copy a boxed object (if possible)
208+
209+
function to deep copy a boxed object (if possible)
210+
The following cases are handled (in this precedence):
211+
212+
- Basic F# types (bool, byte, sbyte, int16, uint16, int, uint, int64, uint64, nativeint, unativeint, float, float32, char, string, unit, decimal)
213+
214+
- ResizeArrays and Dictionaries containing any combination of basic F# types
215+
216+
- Dictionaries containing DynamicObj as keys or values in any combination with DynamicObj or basic F# types as keys or values
217+
218+
- array<DynamicObj>, list<DynamicObj>, ResizeArray<DynamicObj>: These collections of DynamicObj are copied as a new collection with recursively deep copied elements.
219+
220+
- System.ICloneable: If the property implements ICloneable, the Clone() method is called on the property.
221+
222+
- DynamicObj (and derived classes): properties that are themselves DynamicObj instances are deep copied recursively.
223+
if a derived class has static properties (e.g. instance properties), these will be copied as dynamic properties on the new instance.
224+
225+
Note on Classes that inherit from DynamicObj:
226+
227+
Classes that inherit from DynamicObj will match the `DynamicObj` typecheck if they do not implement ICloneable.
228+
The deep copied instances will be cast to DynamicObj with static/instance properties AND dynamic properties all set as dynamic properties.
229+
It should be possible to 'recover' the original type by checking if the needed properties exist as dynamic properties,
230+
and then passing them to the class constructor if needed.
231+
197232
</p>
198233
</div>
199234
</summary>
@@ -205,7 +240,23 @@ <h3>
205240
:
206241
<code>obj</code>
207242
</dt>
208-
<dd class="fsdocs-param-docs"></dd>
243+
<dd class="fsdocs-param-docs">
244+
<p>
245+
The object that should be deep copied
246+
</p>
247+
</dd>
248+
<dt class="fsdocs-param">
249+
<span class="fsdocs-param-name">
250+
?includeInstanceProperties
251+
</span>
252+
:
253+
<code>bool</code>
254+
</dt>
255+
<dd class="fsdocs-param-docs">
256+
<p>
257+
Whether to include instance properties (= 'static' properties on the class) as dynamic properties on the new instance for matched DynamicObj. Default is true
258+
</p>
259+
</dd>
209260
</dl>
210261
<dl class="fsdocs-returns">
211262
<dt>

0 commit comments

Comments
 (0)