NullableExtensions.DangerousGetValueOrDefaultReference<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a reference to the value of the input Nullable<T> instance, regardless of whether
the HasValue property is returning true
or not. If that is not
the case, this method will still return a reference to the underlying default
value.
public static ref T DangerousGetValueOrDefaultReference<T> (this ref T? value) where T : struct;
static member DangerousGetValueOrDefaultReference : Nullable -> 'T (requires 'T : struct)
<Extension()>
Public Function DangerousGetValueOrDefaultReference(Of T As Structure) (ByRef value As Nullable(Of T)) As T
Type Parameters
- T
The type of the underlying value
Parameters
- value
- Nullable<T>
The Nullable<T>
Returns
A reference to the underlying value from the input Nullable<T> instance.
Remarks
Note that attempting to mutate the returned reference will not change the value returned by HasValue. That means that reassigning the value of an empty instance will not make HasValue return true
.