Skip to main content
.NET 6.0+

XPCollection<T>.Lookup(Object) Method

Retrieves a T object from the collection by a specified key value.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

public T Lookup(
    object key
)

Parameters

Name Type Description
key Object

A key value of an object to retrieve from the collection.

Returns

Type Description
T

A T object found or null reference (Nothing in VisualBasic) if an object does not exist in the collection.

Remarks

If the XPBaseCollection.LoadingEnabled property is set to true (default value), the collection will be automatically populated with data (if it’s still not populated) when its contents are accessed for the first time.

Note

The Lookup and Session.GetObjectByKey methods do not find objects until they are saved to a data store.

See Also