Example #1
0
        /// <summary>
        /// Creates a relational pattern that compares against a constant value.
        /// </summary>
        /// <param name="info">Type information about the pattern.</param>
        /// <param name="type">The type of the pattern.</param>
        /// <param name="value">The value to compare with.</param>
        /// <returns>A <see cref="RelationalCSharpPattern" /> representing a relational pattern.</returns>
        public static RelationalCSharpPattern Relational(CSharpPatternInfo info, CSharpPatternType type, ConstantExpression value)
        {
            switch (type)
            {
            case CSharpPatternType.LessThan:
            case CSharpPatternType.LessThanOrEqual:
            case CSharpPatternType.GreaterThan:
            case CSharpPatternType.GreaterThanOrEqual:
                return(RelationalCSharpPattern.Make(info, type, value));

            default:
                throw Error.InvalidRelationalPatternType(type);
            }
        }
Example #2
0
 /// <summary>
 /// Creates a relational greater than or equal pattern that compares against a constant value.
 /// </summary>
 /// <param name="info">Type information about the pattern.</param>
 /// <param name="value">The value to compare with.</param>
 /// <returns>A <see cref="RelationalCSharpPattern" /> representing a relational pattern.</returns>
 public static RelationalCSharpPattern GreaterThanOrEqual(CSharpPatternInfo info, ConstantExpression value) => RelationalCSharpPattern.Make(info, CSharpPatternType.GreaterThanOrEqual, value);
Example #3
0
 /// <summary>
 /// Creates a relational less than pattern that compares against a constant value.
 /// </summary>
 /// <param name="info">Type information about the pattern.</param>
 /// <param name="value">The value to compare with.</param>
 /// <returns>A <see cref="RelationalCSharpPattern" /> representing a relational pattern.</returns>
 public static RelationalCSharpPattern LessThan(CSharpPatternInfo info, ConstantExpression value) => RelationalCSharpPattern.Make(info, CSharpPatternType.LessThan, value);