Partager via


> Operator (C# Reference) 

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

Remarks

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.

Example

// cs_operator_greater_than.cs
using System;
class MainClass
{
    static void Main() 
    {
        Console.WriteLine(1.1 > 1);
        Console.WriteLine(1.1 > 1.1);
    }
}

Output

True
False

See Also

Reference

C# Operators
explicit (C# Reference)

Concepts

C# Programming Guide

Other Resources

C# Reference