Path: redb/redb.Examples/Examples/E169_ArrayContainsOr.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/E169_ArrayContainsOr.cs ---- using System.Diagnostics; using redb.Core; using redb.Examples.Models; using redb.Examples.Output; namespace redb.Examples.Examples; /// /// Demonstrates filtering by multiple array elements using Contains with OR. /// Finds employees who have any of the specified skills. /// Pro feature: multiple array operations in single query. /// [ExampleMeta("E169", "Array - Contains OR", "Query", ExampleTier.Free, 169, "Array", "Contains", "OR", RelatedApis = ["IRedbQueryable.Where", "Array.Contains"])] public class E169_ArrayContainsOr : ExampleBase { public override async Task RunAsync(IRedbService redb) { var sw = Stopwatch.StartNew(); // Find employees who have C# OR Python skill var query = redb.Query() .Where(e => e.Skills != null && (e.Skills.Contains("C#") || e.Skills.Contains("Python"))) .Take(100); // Uncomment to see generated SQL: // var sql = await query.ToSqlStringAsync(); // Console.WriteLine(sql); var results = await query.ToListAsync(); var totalCount = await redb.Query() .Where(e => e.Skills != null && (e.Skills.Contains("C#") || e.Skills.Contains("Python"))) .CountAsync(); sw.Stop(); var csharpCount = results.Count(e => e.Props.Skills?.Contains("C#") == true); var pythonCount = results.Count(e => e.Props.Skills?.Contains("Python") == true); return Ok("E169", "Array - Contains OR", ExampleTier.Free, sw.ElapsedMilliseconds, totalCount, [$"Filter: Skills.Contains(\"C#\") OR Skills.Contains(\"Python\")", $"Found: {totalCount} employees", $"C# devs: {csharpCount}, Python devs: {pythonCount}"]); } }