Class DuplicateUtil
Utility methods for duplication operations.
public static class DuplicateUtil
- Inheritance
-
DuplicateUtil
- Inherited Members
Methods
TryDuplicate<TSelf>(TSelf, params object[])
Attempts to create a duplicate of the source object using the most appropriate method available.
public static TSelf TryDuplicate<TSelf>(this TSelf src, params object[] res) where TSelf : class
Parameters
srcTSelfThe source object to duplicate
resobject[]Optional parameters that may be needed during the duplication process
Returns
- TSelf
A duplicate of the source object if it implements IDuplicate or ICloneable; otherwise, null.
Type Parameters
TSelfThe type of the source object
Remarks
The method first tries to use Duplicate(params object[]) if the source implements IDuplicate. If that's not available, it falls back to Clone() if the source implements ICloneable.