< Operator
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

< Operator

All numeric and enumeration types define a "less than" relational operator (<) that returns true if the first operand is less than the second, false otherwise.

expr1 < expr2

Where:

expr1
An expression.
expr2
An expression.

Remarks

User-defined types can overload the < operator (see operator). If < is overloaded, > must also be overloaded.

Example

// cs_operator_less_than.cs
using System;
class Test 
{
   public static void Main() 
   {
      Console.WriteLine(1 < 1.1);
      Console.WriteLine(1.1 < 1.1);
   }
}

Output

True
False

See Also

C# Operators | 7.9 Relational and type testing operators

Show:
© 2016 Microsoft