Show / Hide Table of Contents

Struct Box<T>

Typed representation of the boxed value type.

Implements
IEquatable<Box<T>>
Inherited Members
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: DotNext.Runtime.CompilerServices
Assembly: DotNext.dll
Syntax
public struct Box<T> : IEquatable<Box<T>> where T : struct
Type Parameters
Name Description
T

The value type to be boxed.

Constructors

| Improve this Doc View Source

Box(T)

Creates boxed representation of the specified value type.

Declaration
public Box(T value)
Parameters
Type Name Description
T value

The value to box.

| Improve this Doc View Source

Box(Object)

Wraps the reference to the boxed value type.

Declaration
public Box(object boxed)
Parameters
Type Name Description
Object boxed

An object representing boxed value type of type T.

Exceptions
Type Condition
ArgumentException

boxed is not of type T.

Properties

| Improve this Doc View Source

IsEmpty

Indicates that this container hold no reference.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

Value

Gets a managed pointer to the boxed value type.

Declaration
public T Value { get; }
Property Value
Type Description
T

The managed pointer to the boxed value type.

See Also
Unbox<T>(Object)

Methods

| Improve this Doc View Source

Equals(Box<T>)

Determines whether this container holds the same reference as the specified container.

Declaration
public bool Equals(Box<T> other)
Parameters
Type Name Description
Box<T> other

The other container to compare.

Returns
Type Description
Boolean

true his container holds the same reference as the specified container; otherwise, false.

| Improve this Doc View Source

Equals(Object)

Determines whether this container holds the same reference as the specified container.

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
Object other

The other container to compare.

Returns
Type Description
Boolean

true his container holds the same reference as the specified container; otherwise, false.

Overrides
ValueType.Equals(Object)
| Improve this Doc View Source

GetHashCode()

Returns hash code of the reference stored in this container.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

The hash code of the reference to the boxed value.

Overrides
ValueType.GetHashCode()
| Improve this Doc View Source

ToString()

Converts stored reference to the string.

Declaration
public override string ToString()
Returns
Type Description
String

The textual representation of the stored reference.

Overrides
ValueType.ToString()

Operators

| Improve this Doc View Source

Equality(Box<T>, Box<T>)

Determines whether the two containers store the references to the same boxed value.

Declaration
public static bool operator ==(Box<T> x, Box<T> y)
Parameters
Type Name Description
Box<T> x

The first container to compare.

Box<T> y

The second container to compare.

Returns
Type Description
Boolean

true if both containers store the references to the same boxed value; otherwise, false.

| Improve this Doc View Source

Explicit(Box<T> to T)

Unboxes the reference value.

Declaration
public static explicit operator T(Box<T> box)
Parameters
Type Name Description
Box<T> box

The boxed representation of value type.

Returns
Type Description
T

Unboxed value type.

| Improve this Doc View Source

Inequality(Box<T>, Box<T>)

Determines whether the two containers store the references to the different boxed values.

Declaration
public static bool operator !=(Box<T> x, Box<T> y)
Parameters
Type Name Description
Box<T> x

The first container to compare.

Box<T> y

The second container to compare.

Returns
Type Description
Boolean

true if both containers store the references to the different boxed values; otherwise, false.

Implements

System.IEquatable<T>

Extension Methods

ValueTypeExtensions.IsOneOf<T>(T, IEnumerable<T>)
ValueTypeExtensions.IsOneOf<T>(T, T[])
Sequence.Skip<TEnumerator, T>(ref TEnumerator, Int32)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX