Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
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.

< Operator (C# Reference)

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.

User-defined types can overload the < operator (see operator). If < is overloaded, > must also be overloaded. When a binary operator is overloaded, the corresponding assignment operator, if any, is also implicitly overloaded.

// cs_operator_less_than.cs
using System;
class MainClass
    static void Main() 
        Console.WriteLine(1 < 1.1);
        Console.WriteLine(1.1 < 1.1);



Community Additions

© 2015 Microsoft