IRuntimeHelper.GetFirstItem<T> Method
Gets the first metadata object in the enumeration.
Namespace: Microsoft.BusinessData.Runtime
Assembly: Microsoft.BusinessData (in Microsoft.BusinessData.dll)
Syntax
'Declaration
Function GetFirstItem(Of T As {Class, IMetadataObject}) ( _
collection As IEnumerable _
) As T
'Usage
Dim instance As IRuntimeHelper
Dim collection As IEnumerable
Dim returnValue As T
returnValue = instance.GetFirstItem(collection)
T GetFirstItem<T>(
IEnumerable collection
)
where T : class, IMetadataObject
Type Parameters
- T
The type of the metadata object.
Parameters
collection
Type: System.Collections.IEnumerableThe collection of objects that can be enumerated.
Return Value
Type: T
The first item in the enumeration.
Exceptions
Exception | Condition |
---|---|
MetadataObjectNotFoundException | The given collection is empty. |
Remarks
If the collection contains more than one item, the item returned by this method is not deterministic.