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
src
TSelfThe source object to duplicate
res
object[]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
TSelf
The 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.