Struct Box<T>
Typed representation of the boxed value type.
Implements
Inherited Members
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 SourceBox(T)
Creates boxed representation of the specified value type.
Declaration
public Box(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to box. |
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 |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
Properties
| Improve this Doc View SourceIsEmpty
Indicates that this container hold no reference.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
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
Methods
| Improve this Doc View SourceEquals(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. |
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
| Improve this Doc View SourceGetHashCode()
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
| Improve this Doc View SourceToString()
Converts stored reference to the string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The textual representation of the stored reference. |
Overrides
Operators
| Improve this Doc View SourceEquality(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. |
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. |
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. |