The Criteria class is used when executing the Load method and you want to get an array of objects in return.

The class has three fields: Field, MatchType, and Value.  The MatchType is an enumeration indicating what type of operator to use in the criteria.  It is up to you to provide the proper Field name.

The supported operators are:

  • Equals (Field = value)
  • Contains (Field like %Value%)
  • BeginsWith (Field like Value%)
  • EndsWith (Field like %Value)
  • GreaterThan (Field > Value)
  • LessThan (Field < Value)

When you group an array of Criteria objects together, the expressions are evaluated using the AND operator.  This group (array) of criteria can be sent to the Load method.  When you need to use the OR operator in criteria, you create multiple arrays of Criteria objects and pass the arrays to the Load method.  The multiple arrays will be joined with OR operators.