ItemCollection.TryGetItem<T> 方法 (String, T%)

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

使用指定的标识从此项集合中返回一个强类型的 GlobalItem 对象。

命名空间:  System.Data.Entity.Core.Metadata.Edm
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
Public Function TryGetItem(Of T As GlobalItem) ( _
    identity As String, _
    <OutAttribute> ByRef item As T _
) As Boolean
用法
Dim instance As ItemCollection 
Dim identity As String 
Dim item As T
Dim returnValue As Boolean 

returnValue = instance.TryGetItem(identity, _
    item)
public bool TryGetItem<T>(
    string identity,
    out T item
)
where T : GlobalItem
public:
generic<typename T>
where T : GlobalItem 
bool TryGetItem(
    String^ identity, 
    [OutAttribute] T% item
)
member TryGetItem : 
        identity:string * 
        item:'T byref -> bool   when 'T : GlobalItem
JScript does not support generic types and methods.

类型参数

  • T
    由方法返回的类型。

参数

  • item
    类型:T%
    在此方法返回时,此输出参数会包含一个 GlobalItem 对象。 如果项集合中不存在具有指定标识的全局项,此输出参数将包含 null。

返回值

类型:System.Boolean
如果存在与搜索条件匹配的项,则为 true;否则为 false。

请参阅

参考

ItemCollection 类

TryGetItem 重载

System.Data.Entity.Core.Metadata.Edm 命名空间