Boxed<T>

Namespace: SnowBank.Runtime · struct

Implements: IEquatable<Boxed<T>>, IComparable<Boxed<T>>, IEquatable<T>, IComparable<T>

Wraps any type of CLR objects

Remarks

Can be used to bpass a ref type to a generic type or method that only accept structs, or to workaround some limitations in generic type constraints

Constructors

Boxed<T>

Boxed<T>(T value)

Properties

Default

static Boxed<T> Default { get; }

IsNull

bool IsNull { get; }

Methods

Cast

TTarget Cast<TTarget>()

Converts a value of type T in to a value of type TTarget

If and are parent/child we can do direct casting. Otherwise, we call

CompareTo

int CompareTo(Boxed<T> other)

int CompareTo(T other)

Equals

bool Equals(Boxed<T> other)

bool Equals(T other)

bool Equals(object obj)

GetHashCode

int GetHashCode()

IsA

bool IsA<TBase>()

Returns true if the type T is compatible with the type TBase

OrDefault

T OrDefault(T defaultValue)

Fields

Value

readonly T Value