Skip to main content
.NET 8.0+

XPQueryExtensions.EnumerateAsync<T>(IQueryable<T>, XPQueryExtensions.AsyncEnumerateCallback<T>) Method

Asynchronously enumerates a specified query and notifies upon completion.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public static void EnumerateAsync<T>(
    this IQueryable<T> query,
    XPQueryExtensions.AsyncEnumerateCallback<T> callback
)

Parameters

Name Type Description
query IQueryable<T>

An XPQuery<T> to be enumerated.

callback DevExpress.Xpo.XPQueryExtensions.AsyncEnumerateCallback<T>

An AsyncEnumerateCallback<T> delegate, which is a method to be called after all elements in the query are enumerated.

Type Parameters

Name
T

Remarks

Example:

using System.Linq;
using DevExpress.Xpo;
using System.Collections.Generic;

// ...

var data = from c in session1.Query<Person>()
           where c.LastName.StartsWith("A")
           select c;

// Asynchronously loads XPQuery and enumerates it
data.EnumerateAsync<Contact>(delegate(IEnumerable<Contact> objects, Exception ex)
{
    // Process loaded objects here
});
See Also