Class Operator
An operator that may appear in a query - a comparison, a boolean connective, or a collection quantifier - identified by the name a client sends for it.
public class Operator
- Inheritance
-
Operator
- Derived
- Inherited Members
Remarks
Every operator is a singleton declared as one of the static fields below, and constructing one registers it so that FromString(string) can find it. The names are part of the wire format and cannot be changed without breaking clients.
Constructors
Operator(string, OperatorType)
Create an operator and register it for lookup by FromString(string).
public Operator(string aliases, OperatorType opType)
Parameters
aliasesstringComma-separated names for the operator; the first becomes its Name.
opTypeOperatorTypeWhich kind of predicate the operator builds.
Fields
All
True when every item of a collection satisfies the inner predicate.
public static Operator All
Field Value
And
Boolean conjunction of two or more predicates.
public static Operator And
Field Value
Any
True when at least one item of a collection satisfies the inner predicate.
public static Operator Any
Field Value
Contains
Substring test, compiled to Contains(string).
public static BinaryOperator Contains
Field Value
EndsWith
String suffix test, compiled to EndsWith(string).
public static BinaryOperator EndsWith
Field Value
Equals
Equality. Declared new because it hides the inherited Equals(object).
public static BinaryOperator Equals
Field Value
GreaterThan
Ordered comparison, strictly greater than.
public static BinaryOperator GreaterThan
Field Value
GreaterThanOrEqual
Ordered comparison, greater than or equal.
public static BinaryOperator GreaterThanOrEqual
Field Value
In
Set membership. Its right-hand argument must be an array, and compiles to List<T>.Contains.
public static BinaryOperator In
Field Value
LessThan
Ordered comparison, strictly less than.
public static BinaryOperator LessThan
Field Value
LessThanOrEqual
Ordered comparison, less than or equal.
public static BinaryOperator LessThanOrEqual
Field Value
Not
Boolean negation of a single predicate.
public static Operator Not
Field Value
NotEquals
Inequality.
public static BinaryOperator NotEquals
Field Value
Or
Boolean disjunction of two or more predicates.
public static Operator Or
Field Value
StartsWith
String prefix test, compiled to StartsWith(string).
public static BinaryOperator StartsWith
Field Value
_aliases
The names this operator was declared with; the first of them is its Name.
public List<string> _aliases
Field Value
_opMap
Every registered operator, keyed by its lower-cased Name. Prefer FromString(string) over reaching into this.
public static Dictionary<string, Operator> _opMap
Field Value
Properties
Name
The operator's primary name - the first of the aliases it was declared with, e.g. "eq".
public string Name { get; }
Property Value
OpType
Which kind of predicate this operator builds, and so how its operands are read.
public OperatorType OpType { get; }
Property Value
Methods
FromString(string)
Look up an operator by the name a client sent. Matching is case-insensitive and is done on Name.
public static Operator? FromString(string op)
Parameters
opstringThe operator name, e.g. "eq" or "startswith".
Returns
- Operator
The operator, or null if no operator is registered under that name.