Class CopyExtensions
A set of extensions for dealing with copying objects.
[Obsolete("CopyExtensions has major flaws and insufficient speed compared to other libraries specifically designed for copying objects.")]
public static class CopyExtensions
- Inheritance
-
CopyExtensions
- Inherited Members
Methods
CopyInto<T>(T, T, BindingFlags, Predicate<FieldInfo>)
Copies the given object obj
into the given object otherObj
in a shallow manner.
[Obsolete("CopyExtensions has major flaws and insufficient speed compared to other libraries specifically designed for copying objects.")]
public static void CopyInto<T>(this T obj, T otherObj, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Predicate<FieldInfo> fieldInclusion = null)
Parameters
obj
TThe object to create a shallow copy of
otherObj
TThe object to copy into
flags
BindingFlagsThe binding flags for field searching
fieldInclusion
Predicate<FieldInfo>A predicate that determines whether or not the given field should be copied. If null, all fields will be copied.
Type Parameters
T
The type of the object to copy
Copy<T>(T, BindingFlags, Predicate<FieldInfo>)
Creates a shallow copy of the object and returns it. Object creation occurs using a constructor with the CopyConstructorAttribute or, if none is present, the first constructor with the correct BindingFlags.
[Obsolete("CopyExtensions has major flaws and insufficient speed compared to other libraries specifically designed for copying objects.")]
public static T Copy<T>(this T obj, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Predicate<FieldInfo> fieldInclusion = null)
Parameters
obj
TThe object to create a shallow copy of
flags
BindingFlagsThe binding flags for field searching
fieldInclusion
Predicate<FieldInfo>A predicate that determines whether or not the given field should be copied. If null, all fields will be copied.
Returns
- T
A shallow copy of the object
Type Parameters
T
The type of the object to copy
DeepCopyInto<T>(T, T, BindingFlags, Predicate<FieldInfo>)
Copies the given object obj
into the given object otherObj
in a deep manner.
Object creation occurs using a constructor with the CopyConstructorAttribute or, if none is present, the first constructor with the correct BindingFlags.
[Obsolete("CopyExtensions has major flaws and insufficient speed compared to other libraries specifically designed for copying objects.")]
public static void DeepCopyInto<T>(this T obj, T otherObj, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Predicate<FieldInfo> fieldInclusion = null)
Parameters
obj
TThe object to create a deep copy of
otherObj
TThe object to copy into
flags
BindingFlagsThe binding flags for field searching
fieldInclusion
Predicate<FieldInfo>A predicate that determines whether or not the given field should be copied. If null, all fields will be copied.
Type Parameters
T
The type of the object to copy
DeepCopy<T>(T, BindingFlags, Predicate<FieldInfo>)
Creates a deep copy of the object and returns it. Object creation occurs using a constructor with the CopyConstructorAttribute or, if none is present, the first constructor with the correct BindingFlags.
[Obsolete("CopyExtensions has major flaws and insufficient speed compared to other libraries specifically designed for copying objects.")]
public static T DeepCopy<T>(this T obj, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Predicate<FieldInfo> fieldInclusion = null)
Parameters
obj
TThe object to create a deep copy of
flags
BindingFlagsThe binding flags for field searching
fieldInclusion
Predicate<FieldInfo>A predicate that determines whether or not the given field should be copied. If null, all fields will be copied.
Returns
- T
A deep copy of the object
Type Parameters
T
The type of the object to copy