.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

How to: Obtain a Collection of Persistent Objects for Processing

The XPCollection is a component with a lot of features. It implements the IBindingList and ITypedList interfaces, supports on-the-fly filtering and sorting and it can be bound to visual controls. Obviously, you don't need this functionality for background data processing. It may make sense to load objects into a simple array rather than to use the XPCollection. Use LINQ to XPO as shown in the example below:

using System;
using System.Collections.Generic;
using System.Linq;
using DevExpress.Xpo;
// ...
void ProcessDiscontinued(Session session) {
    IEnumerable<Product> products = session.Query<Product>()
        .Where(p => p.IsDiscontinued)
        .OrderBy(p => p.Price);
    foreach(Product product in products) {
        // Do some action with the product object.
        Console.WriteLine("{0,-25} {1,8:c}   discontinued: {2}", product.Name, product.Price,