Extensions.GetValueOrDefault<T>(IBotDataBag, String, T) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得與指定金鑰相關的值,或若未找到則為預設值。
public static T GetValueOrDefault<T>(this Microsoft.Bot.Builder.Dialogs.IBotDataBag bag, string key, T defaultValue = default);
static member GetValueOrDefault : Microsoft.Bot.Builder.Dialogs.IBotDataBag * string * 'T -> 'T
<Extension()>
Public Function GetValueOrDefault(Of T) (bag As IBotDataBag, key As String, Optional defaultValue As T = Nothing) As T
類型參數
- T
要取得的價值類型。
參數
- bag
- IBotDataBag
機器人資料袋。
- key
- String
關鍵在於要取得或設定的價值。
- defaultValue
- T
若不存在金鑰,則要回傳的值
傳回
T
與指定鍵相關聯的值。 若未找到指定金鑰,則 defaultValue 回傳