Table of Contents

Class Wrapper<T>

Namespace
Cuemon.Extensions
Assembly
Cuemon.Extensions.Core.dll

Provides a way to wrap an object of type T.

public class Wrapper<T> : IWrapper<T>, IData

Type Parameters

T

The type of the object to wrap.

Inheritance
Wrapper<T>
Implements
Derived
Extension Methods

Constructors

Wrapper()

Initializes a new instance of the Wrapper<T> class.

protected Wrapper()

Wrapper(T, MemberInfo)

Initializes a new instance of the Wrapper<T> class.

public Wrapper(T instance, MemberInfo memberReference = null)

Parameters

instance T

The instance that this wrapper object represents.

memberReference MemberInfo

The member from where instance was referenced.

Properties

Data

Gets a collection of key/value pairs that provide additional user-defined information about this wrapper object.

public virtual IDictionary<string, object> Data { get; }

Property Value

IDictionary<String, Object>

An object that implements the IDictionary<TKey,TValue> interface and contains a collection of user-defined key/value pairs.

HasMemberReference

Gets a value indicating whether this instance has a member reference.

public virtual bool HasMemberReference { get; }

Property Value

Boolean

true if this instance has a member reference; otherwise, false.

Instance

Gets the object that this wrapper represents.

public virtual T Instance { get; protected set; }

Property Value

T

The object that this wrapper represents.

InstanceType

Gets the type of the object that this wrapper represents.

public virtual Type InstanceType { get; protected set; }

Property Value

Type

The type of the that this wrapper represents.

MemberReference

Gets the member from where Instance was referenced.

public virtual MemberInfo MemberReference { get; protected set; }

Property Value

MemberInfo

The member from where Instance was referenced.

Methods

InstanceAs<TResult>()

Returns a value that is equivalent to the instance of the object that this wrapper represents.

public TResult InstanceAs<TResult>()

Returns

TResult

A value that is equivalent to the instance of the object that this wrapper represents.

Type Parameters

TResult

The type of the return value.

Exceptions

InvalidCastException

The conversion is not supported - or - Instance does not implement the IConvertible interface.

FormatException

Instance is not in a format for T recognized by InvariantCulture.

OverflowException

Instance represents a number that is out of the range of T.

InstanceAs<TResult>(IFormatProvider)

Returns a value that is equivalent to the instance of the object that this wrapper represents.

public TResult InstanceAs<TResult>(IFormatProvider provider)

Parameters

provider IFormatProvider

An object that supplies culture-specific formatting information.

Returns

TResult

A value that is equivalent to the instance of the object that this wrapper represents.

Type Parameters

TResult

The type of the return value.

Exceptions

InvalidCastException

The conversion is not supported - or - Instance does not implement the IConvertible interface.

FormatException

Instance is not in a format for T recognized by provider.

OverflowException

Instance represents a number that is out of the range of T.

ToString()

Returns a String that represents this instance.

public override string ToString()

Returns

String

A String that represents this instance.