Query<T> Class

Represents a compiled query that can be evaluated against objects.

public sealed class Query<T>

Type parameters

T
The type of object to query against.

Example

var queryBuilder = new QueryBuilder<Person>();
queryBuilder.AddHandler<string>("name", (obj, value) => obj.FullName.Contains(value, StringComparison.OrdinalIgnoreCase));
var query = queryBuilder.Build("name:john");
Assert.True(query.Evaluate(new Person("John Doe", new DateTime(2000, 1, 1))));

Properties

NameDescription
TextGets the original query text.

Gets the original query text.

public string Text { get; }

Property value

string

Methods

NameDescription
Evaluate(T)Evaluates the query against an object.

Evaluate(T)

Query`1.cs

Evaluates the query against an object.

public bool Evaluate(T value)

Parameters

value T
The object to evaluate.

Returns

bool true if the object matches the query; otherwise, false.