Previous Docs Version

The documentation you are viewing is for a previous version of the Vendr product. Click here to jump to the current stable version.

ObjectExtensions

API reference for ObjectExtensions in Vendr, the eCommerce solution for Umbraco v8+

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

Edit this page on GitHub

Site + logo design © 2024 Outfield Digital Ltd. Content contributions licensed under MIT.
Vendr® is a Registered Trademark of Outfield Digital Ltd.