Skip to content

Docs: Tables -> Querying with Indexes for C# does not work as written #4130

@rekhoff

Description

@rekhoff

Documentation of Tables in the Querying with Indexes for Range Queries for C# is incorrect.
It reads:

// Find users aged 18 or older
foreach (var user in ctx.Db.User.Age.Filter(new Bound<byte>.Inclusive(18), null))
{
    Log.Info($"{user.Name} is an adult");
}

Bound does not expose .Inclusive/.Exclusive constructors (these are in the internal namespace). Instead you pass the min/max values directly (or use tuple literals). The corrected example should look like:

// Find users aged 18 or older (inclusive)
foreach (var user in ctx.Db.User.Age.Filter(new Bound<byte>(18, byte.MaxValue)))
{
    Log.Info($"{user.Name} is an adult");
}

You can also use the implicit tuple conversion, like ctx.Db.User.Age.Filter((18, byte.MaxValue)), which is functionally identical.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions