Class ObjectExtensions
Extension class used to provide various functionality to all CLR objects.
Inherited Members
Namespace: SuperOffice.Util
Assembly: SoCore.dll
Syntax
public static class ObjectExtensions
Methods
AssignByReflection<T>(T, T)
Copies all public writable & public properties from the source-instance to the provided
target instance.
This operation is applied recursively for all non-primitive types, meaning that the two instances
should be 100% independent and unable to mutate each others members.
Declaration
public static void AssignByReflection<T>(this T source, T destination) where T : new()
Parameters
Type | Name | Description |
---|---|---|
T | source | Source instance |
T | destination | Targetinstance |
Type Parameters
Name | Description |
---|---|
T | Type of object whose properties we want to copy. |
GraphCopy<T>(T)
Creates a copy of the provided object-graph by copying all public properties of the provided
instance.
This operation is applied recursively for all non-primitive types, meaning that the resulting instance
should be 100% independent from the instance provided and that the two instances should be unable to
mutate each others members.
Declaration
public static T GraphCopy<T>(this T source) where T : new()
Parameters
Type | Name | Description |
---|---|---|
T | source | Source instance |
Returns
Type | Description |
---|---|
T | A 100% independent copy. |
Type Parameters
Name | Description |
---|---|
T | Type of object whose properties we want to copy. |