ParameterView.GetValueOrDefault 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
GetValueOrDefault<TValue>(String) |
取得具有指定名稱的參數值,如果集合中沒有這類參數,則為預設值。 |
GetValueOrDefault<TValue>(String, TValue) |
取得具有指定名稱的參數值,如果集合中沒有這類參數,則取得指定的預設值。 |
GetValueOrDefault<TValue>(String)
取得具有指定名稱的參數值,如果集合中沒有這類參數,則為預設值。
public:
generic <typename TValue>
TValue GetValueOrDefault(System::String ^ parameterName);
public TValue GetValueOrDefault<TValue> (string parameterName);
public TValue? GetValueOrDefault<TValue> (string parameterName);
member this.GetValueOrDefault : string -> 'Value
Public Function GetValueOrDefault(Of TValue) (parameterName As String) As TValue
類型參數
- TValue
值的類型。
參數
- parameterName
- String
參數名稱。
傳回
TValue
找到的參數值;否則為指定型別的預設值。
適用於
GetValueOrDefault<TValue>(String, TValue)
取得具有指定名稱的參數值,如果集合中沒有這類參數,則取得指定的預設值。
public:
generic <typename TValue>
TValue GetValueOrDefault(System::String ^ parameterName, TValue defaultValue);
public TValue GetValueOrDefault<TValue> (string parameterName, TValue defaultValue);
member this.GetValueOrDefault : string * 'Value -> 'Value
Public Function GetValueOrDefault(Of TValue) (parameterName As String, defaultValue As TValue) As TValue
類型參數
- TValue
值的類型。
參數
- parameterName
- String
參數名稱。
- defaultValue
- TValue
如果集合中沒有這類參數,要傳回的預設值。
傳回
TValue
找到的參數值;否則 defaultValue
為 。