Numeric and Comparison Operators

Arithmetic and comparison operators work as expected in the common language runtime (CLR) except as follows:

  • SQL does not support the modulus operator on floating-point numbers.

  • SQL does not support unchecked arithmetic.

  • Increment and decrement operators cause side-effects when you use them in expressions that cannot be replicated in SQL and are, therefore, not supported.

Supported Operators

LINQ to SQL supports the following operators.

  • Basic arithmetic operators:

    • +

    • - (subtraction)

    • *

    • /

    • Visual Basic integer division (\)

    • % (Visual Basic Mod)

    • <<

    • >>

    • - (unary negation)

  • Basic comparison operators:

    • Visual Basic = and C# ==

    • Visual Basic <> and C# !=

    • Visual Basic Is/IsNot

    • <

    • <=

    • >

    • >=

See also