Extensions.GetValueOrDefault<T>(IBotDataBag, String, T) Method

Definition

Gets the value associated with the specified key or a default value if not found.

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

Type Parameters

T

The type of the value to get.

Parameters

bag
IBotDataBag

The bot data bag.

key
String

The key of the value to get or set.

defaultValue
T

The value to return if the key is not present

Returns

T

The value associated with the specified key. If the specified key is not found, defaultValue is returned

Applies to