Skip to main content
.NET 8.0+

XPBaseCollection.LoadAsync(CancellationToken) Method

Asynchronously loads persistent objects of a specific type from the data store into the collection.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

NuGet Package: DevExpress.Xpo

#Declaration

public virtual Task LoadAsync(
    CancellationToken cancellationToken
)

#Parameters

Name Type Description
cancellationToken CancellationToken

A CancellationToken object that delivers a cancellation notice to the running operation.

#Returns

Type Description
Task

A Task that starts the collection load.

#Remarks

Note

If the XPBaseCollection.LoadingEnabled property is set to false, calling the LoadAsync method has no effect.

The following example demonstrates how to asynchronously work with persistent objects.

using DevExpress.Xpo;
// ...
XPCollection<Customer> customers = new XPCollection<Customer>(session);
await customers.LoadAsync();
gridControl.DataSource = customers;
See Also