Struct LocalReference<T>
Represents a typed reference that can be passed as a generic argument.
Inherited Members
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public readonly ref struct LocalReference<T> : ITypedReference<T>, IEquatable<LocalReference<T>> where T : allows ref struct
Type Parameters
| Name | Description |
|---|---|
| T | The type of the referenced value. |
Constructors
View SourceLocalReference(ref T)
Represents a typed reference that can be passed as a generic argument.
Declaration
public LocalReference(ref T location)
Parameters
| Type | Name | Description |
|---|---|---|
| T | location | The location of the value. |
Properties
View SourceIsEmpty
Gets a value indicating that this reference is empty.
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Value
The referenced value.
Declaration
public ref T Value { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
View SourceEquals(LocalReference<T>)
Declaration
public bool Equals(LocalReference<T> other)
Parameters
| Type | Name | Description |
|---|---|---|
| LocalReference<T> | other |
Returns
| Type | Description |
|---|---|
| bool |
Operators
View Sourceoperator ==(LocalReference<T>, LocalReference<T>)
Checks whether the two references point to the same memory location.
Declaration
public static bool operator ==(LocalReference<T> x, LocalReference<T> y)
Parameters
| Type | Name | Description |
|---|---|---|
| LocalReference<T> | x | The first reference to compare. |
| LocalReference<T> | y | The second reference to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if both references point to the same memory location; otherwise, false. |
implicit operator ReadOnlyLocalReference<T>(LocalReference<T>)
Converts mutable typed reference to the read-only typed reference.
Declaration
public static implicit operator ReadOnlyLocalReference<T>(LocalReference<T> reference)
Parameters
| Type | Name | Description |
|---|---|---|
| LocalReference<T> | reference | The reference to convert. |
Returns
| Type | Description |
|---|---|
| ReadOnlyLocalReference<T> | Read-only view of the same memory location as presented by |
implicit operator Variant(LocalReference<T>)
Converts typed local reference to the variant value.
Declaration
public static implicit operator Variant(LocalReference<T> reference)
Parameters
| Type | Name | Description |
|---|---|---|
| LocalReference<T> | reference | The reference to convert. |
Returns
| Type | Description |
|---|---|
| Variant | The variant mutable value. |
operator !=(LocalReference<T>, LocalReference<T>)
Checks whether the two references point to the different memory locations.
Declaration
public static bool operator !=(LocalReference<T> x, LocalReference<T> y)
Parameters
| Type | Name | Description |
|---|---|---|
| LocalReference<T> | x | The first reference to compare. |
| LocalReference<T> | y | The second reference to compare. |
Returns
| Type | Description |
|---|---|
| bool | true if both references point to the different memory locations; otherwise, false. |