Nullable.GetValueRefOrDefaultRef<T>(Nullable<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.
Retrieves a readonly reference to the location in the Nullable<T> instance where the value is stored.
public:
generic <typename T>
where T : value class static T& ^ GetValueRefOrDefaultRef(Nullable<T> % nullable);
public static ref readonly T GetValueRefOrDefaultRef<T> (in T? nullable) where T : struct;
public static ref readonly T GetValueRefOrDefaultRef<T> (ref T? nullable) where T : struct;
static member GetValueRefOrDefaultRef : Nullable -> 'T (requires 'T : struct)
Public Shared Function GetValueRefOrDefaultRef(Of T As Structure) (ByRef nullable As Nullable(Of T)) As T
Type Parameters
- T
The underlying value type of the Nullable<T> generic type.
Parameters
- nullable
- Nullable<T>
The readonly reference to the input Nullable<T> value.
Returns
A readonly reference to the location where the instance's T
value is stored. If the instance's HasValue is false
, the current value at that location may be the default value.
Remarks
As the returned readonly reference refers to data that is stored in the input nullable
value, this method should only ever be
called when the input reference points to a value with an actual location and not an "rvalue" (an expression that may appear on the right side but not left side of an assignment). That is, if this API is called and the input reference
points to a value that is produced by the compiler as a defensive copy or a temporary copy, the behavior might not match the desired one.
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示