ObjectExtensions
Object extension methods
public static class ObjectExtensions
Namespace
Methods
ComparesTo<T>
Compares a source object against a given value using the supplied comparison operator
public static bool ComparesTo<T>(this T source, T value, ComparisonOperator comparisonOperator)
where T : IComparable
Parameters
Parameter | Description |
---|---|
T
|
The Type of the source / value objects
|
source
|
The Source object to compare
|
value
|
The Value to compare against
|
comparisonOperator
|
The comparison operator to use for the comparison
|
Returns
Boolean indicating whether the comparison was successful or not
IsObsolete
Determines if the given object is decorated as being obsolete
public static bool IsObsolete(this object obj)
Parameters
Parameter | Description |
---|---|
obj
|
The object to check
|
Returns
True if the type is obsolete, otherwise False
ToDictionary
Converts a generic object into a dictionary, converting the object properties into key value pairs
public static IDictionary<string, object> ToDictionary(this object data,
bool honorSerializationAttributes = false)
Parameters
Parameter | Description |
---|---|
data
|
The object to convert
|
honorSerializationAttributes
|
True to honor DataMember/JsonProperty attributes for property names
|
Returns
The converted dictionary