Share via


ItemCollection.TryGetItem 方法

定义

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

重载

TryGetItem<T>(String, T)

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

TryGetItem<T>(String, Boolean, T)

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

TryGetItem<T>(String, T)

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

public:
generic <typename T>
 where T : System::Data::Metadata::Edm::GlobalItem bool TryGetItem(System::String ^ identity, [Runtime::InteropServices::Out] T % item);
public bool TryGetItem<T> (string identity, out T item) where T : System.Data.Metadata.Edm.GlobalItem;
member this.TryGetItem : string * 'T -> bool (requires 'T :> System.Data.Metadata.Edm.GlobalItem)
Public Function TryGetItem(Of T As GlobalItem) (identity As String, ByRef item As T) As Boolean

类型参数

T

由方法返回的类型。

参数

identity
String

项的标识。

item
T

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

返回

如果存在符合搜索条件的项,则为 true;否则为 false

适用于

TryGetItem<T>(String, Boolean, T)

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

public:
generic <typename T>
 where T : System::Data::Metadata::Edm::GlobalItem bool TryGetItem(System::String ^ identity, bool ignoreCase, [Runtime::InteropServices::Out] T % item);
public bool TryGetItem<T> (string identity, bool ignoreCase, out T item) where T : System.Data.Metadata.Edm.GlobalItem;
member this.TryGetItem : string * bool * 'T -> bool (requires 'T :> System.Data.Metadata.Edm.GlobalItem)
Public Function TryGetItem(Of T As GlobalItem) (identity As String, ignoreCase As Boolean, ByRef item As T) As Boolean

类型参数

T

由方法返回的类型。

参数

identity
String

项的标识。

ignoreCase
Boolean

如果执行不区分大小写的搜索,则为 true;否则为 false

item
T

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

返回

如果存在符合搜索条件的项,则为 true;否则为 false

适用于