Path: redb/redb.Examples/Examples/E053_ArrayWithConditions.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/E053_ArrayWithConditions.cs
----
using System.Diagnostics;
using redb.Core;
using redb.Examples.Models;
using redb.Examples.Output;
namespace redb.Examples.Examples;
///
/// Query employees combining array Contains with other conditions (Pro).
/// Find senior C# developers over 30.
///
[ExampleMeta("E053", "Array Contains + Conditions", "Query",
ExampleTier.Free, 2, "Array", "Contains", "AND", "Pro")]
public class E053_ArrayWithConditions : ExampleBase
{
public override async Task RunAsync(IRedbService redb)
{
var sw = Stopwatch.StartNew();
// Pro: Combine array Contains with other conditions
var query = redb.Query()
.Where(e => e.Skills!.Contains("C#") && e.Age >= 30 && e.Salary > 70000m)
.Take(100);
// Uncomment to see generated SQL:
// var sql = await query.ToSqlStringAsync();
// Console.WriteLine(sql);
var result = await query.ToListAsync();
sw.Stop();
return Ok("E053", "Array Contains + Conditions", ExampleTier.Free, sw.ElapsedMilliseconds, result.Count,
[$"Filter: Skills has 'C#' AND Age >= 30 AND Salary > 70k"]);
}
}