PropertyBag.GetValue 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回具有指定键的值,强制转换为指定类型。
重载
GetValue<T>(Int32) |
返回具有指定键的值,强制转换为指定类型。 |
GetValue<T>(Int32, T) |
返回具有指定键的值,如果集合中没有指定键的项位于指定类型,则返回指定默认值。 |
GetValue<T>(Int32)
返回具有指定键的值,强制转换为指定类型。
public:
generic <typename T>
T GetValue(int index);
public T GetValue<T> (int index);
member this.GetValue : int -> 'T
Public Function GetValue(Of T) (index As Integer) As T
类型参数
- T
返回值的所需类型。
参数
- index
- Int32
要返回的项的键。
返回
T
指定键的值(如果存在)强制转换为类型 T
。
适用于
GetValue<T>(Int32, T)
返回具有指定键的值,如果集合中没有指定键的项位于指定类型,则返回指定默认值。
public:
generic <typename T>
T GetValue(int index, T defaultValue);
public T GetValue<T> (int index, T defaultValue);
member this.GetValue : int * 'T -> 'T
Public Function GetValue(Of T) (index As Integer, defaultValue As T) As T
类型参数
- T
返回值的所需类型。
参数
- index
- Int32
要返回的项的键。
- defaultValue
- T
如果未找到键,则返回) 类型的 T
默认值 (。
返回
T
指定键的值(如果存在)强制转换为类型 T
。