Langue

Extensions.GetValueOrDefault<T>(IBotDataBag, String, T) Méthode

Définition

Obtient la valeur associée à la clé spécifiée ou une valeur par défaut si elle n’est pas trouvée.

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

Paramètres de type

T

Le type de valeur à obtenir.

Paramètres

bag
IBotDataBag

Le sac de données du bot.

key
String

Clé de la valeur à obtenir ou définir.

defaultValue
T

La valeur à retourner si la clé n’est pas présente

Retours

T

Valeur associée à la clé spécifiée. Si la clé spécifiée n’est pas trouvée, defaultValue est retournée

S’applique à