Utility methods for Objects
More...
|
static TOutput | IfNotNull< TInput, TOutput > (this TInput input, Func< TInput, TOutput > expression) |
| Returns the sub element of an object if the object is not null. More...
|
|
static T | DeepClone< T > (T input) |
| Deep Clones an object and returns a new object More...
|
|
static void | MapObjects (object source, object destination) |
| Maps source object properties to destination object that have identical name and type.Mapping is not case sensitive. More...
|
|
static IList< TOut > | MapObjectsList< TIn, TOut > (IEnumerable< TIn > source) |
| Maps all values from the source list to a destination object type and returns a destination object list More...
|
|
Utility methods for Objects
static T Ultimate.Utilities.ObjectUtils.DeepClone< T > |
( |
T |
input | ) |
|
|
static |
Deep Clones an object and returns a new object
- Template Parameters
-
- Parameters
-
- Returns
- A new object cloned from the input
static TOutput Ultimate.Utilities.ObjectUtils.IfNotNull< TInput, TOutput > |
( |
this TInput |
input, |
|
|
Func< TInput, TOutput > |
expression |
|
) |
| |
|
static |
Returns the sub element of an object if the object is not null.
- Template Parameters
-
TInput | input object type |
TOutput | ouput object type |
- Parameters
-
input | input object |
expression | Lambda expression to return the output |
- Returns
- If the input is null then returns the default value of output type else returns the output object
static void Ultimate.Utilities.ObjectUtils.MapObjects |
( |
object |
source, |
|
|
object |
destination |
|
) |
| |
|
static |
Maps source object properties to destination object that have identical name and type.Mapping is not case sensitive.
Uses dictionary to cache the properties info which makes the mapping faster.
- Parameters
-
source | source object to map from |
destination | destination object to map to |
static IList<TOut> Ultimate.Utilities.ObjectUtils.MapObjectsList< TIn, TOut > |
( |
IEnumerable< TIn > |
source | ) |
|
|
static |
Maps all values from the source list to a destination object type and returns a destination object list
- Template Parameters
-
TIn | source object type |
TOut | destination object type |
- Parameters
-
- Returns
- destination object list
The documentation for this class was generated from the following file:
- D:/Projects/Ultimate.Utilities/Ultimate.Utilities/ObjectUtils.cs