Share via


Extensions.GetValue<T>(IBotDataBag, String) 方法

定义

获取与指定键关联的值。

public static T GetValue<T> (this Microsoft.Bot.Builder.Dialogs.IBotDataBag bag, string key);
static member GetValue : Microsoft.Bot.Builder.Dialogs.IBotDataBag * string -> 'T
<Extension()>
Public Function GetValue(Of T) (bag As IBotDataBag, key As String) As T

类型参数

T

要获取的值的类型。

参数

bag
IBotDataBag

机器人数据包。

key
String

要获取或设置的值的键。

返回

T

与指定的键相关联的值。 如果未找到指定的键,则获取操作将引发 KeyNotFoundException。

例外

适用于