Path: redb/redb.Examples/Examples/E098_TreeQueryLeaves.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Examples/Examples/E098_TreeQueryLeaves.cs ---- using System.Diagnostics; using redb.Core; using redb.Examples.Models; using redb.Examples.Output; namespace redb.Examples.Examples; /// /// Find leaf nodes in tree. /// WhereLeaves returns nodes with no children. /// [ExampleMeta("E098", "Tree Query - Leaves Only", "Trees", ExampleTier.Free, 2, "Tree", "TreeQuery", "WhereLeaves", "Pro")] public class E098_TreeQueryLeaves : ExampleBase { public override async Task RunAsync(IRedbService redb) { var sw = Stopwatch.StartNew(); // Find all leaf nodes (no children) var leaves = await redb.TreeQuery() .WhereLeaves() .ToListAsync(); sw.Stop(); var names = leaves.Select(l => $"{l.Name} ({l.Props.Code})").ToArray(); return Ok("E098", "Tree Query - Leaves Only", ExampleTier.Free, sw.ElapsedMilliseconds, leaves.Count, [ "Filter: WhereLeaves() - no children", $"Found: {string.Join(", ", names)}" ]); } }