# LINQ Integration

Curiosity's query system is designed to integrate seamlessly with modern C# features, including LINQ (Language Integrated Query).

The Query interface provides a fluent builder for executing operations on the graph engine. However, once you retrieve results, you often need to perform further processing in memory.

# AsEnumerable() and Standard LINQ

The AsEnumerable() method terminates the graph query and returns an IEnumerable<ReadOnlyNode>. From this point on, you can use standard LINQ methods.

var nodes = Graph.Query()
    .StartAt("Person")
    .AsEnumerable();

// Use standard LINQ
var sortedNames = nodes
    .Where(n => n.GetInt("age") > 30) // In-memory filtering
    .Select(n => ( Name: n.GetString("name"), Age: n.GetInt("age") )) // Projection to Tuple
    .OrderBy(x => x.Name) // In-memory sorting
    .ToList();