Class ObjectExtension
- Namespace
- Loehnert.Utility.Extensions
- Assembly
- Loehnert.Utility.dll
Extensions for objects.
public static class ObjectExtension
- Inheritance
-
ObjectExtension
- Inherited Members
Methods
Copy<T>(T)
Copies the given object using a deep clone mechanism.
public static T Copy<T>(this T original)
Parameters
original
TThe original.
Returns
- T
The cloned object.
Type Parameters
T
Type of the object to clone.
Remarks
From https://github.com/chivandikwa/net-object-deep-copy commit 814eb19.
GetBackingFieldProperty(FieldInfo, Type, BindingFlags)
Gets the backing field property for a given field.
public static PropertyInfo GetBackingFieldProperty(this FieldInfo fieldInfo, Type typeToReflect, BindingFlags bindingFlags)
Parameters
fieldInfo
FieldInfoThe field information.
typeToReflect
TypeThe type to reflect.
bindingFlags
BindingFlagsThe binding flags.
Returns
- PropertyInfo
The backing field property.
Remarks
From https://github.com/chivandikwa/net-object-deep-copy commit 814eb19.
IsBackingField(FieldInfo)
Determines whether the given field is a backing field.
public static bool IsBackingField(this FieldInfo fieldInfo)
Parameters
fieldInfo
FieldInfoThe field information.
Returns
- bool
A value indicating whether the given field is a backing field.
Remarks
From https://github.com/chivandikwa/net-object-deep-copy commit 814eb19.
IsPrimitive(Type)
Determines whether this instance is primitive.
public static bool IsPrimitive(this Type type)
Parameters
type
TypeThe type.
Returns
- bool
A value indicating whether the type is primitive.
Remarks
From https://github.com/chivandikwa/net-object-deep-copy commit 814eb19.
Exceptions
- ArgumentNullException
Thrown when argument is null.