Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

<=: practical reference

<=: practical reference: <= tests whether the left operand is not greater under the type's ordering operator.

Version: C# operator reference; verified against C# 14

Syntax

left <= right

<= tests whether the left operand is not greater under the type's ordering operator.

Use it for an inclusive upper bound with an explicit unit and comparer.

A user type can overload ordering inconsistently with equality.

A comparison with NaN is false, and string needs an explicit comparison instead of this operator.

The complete program actually uses <=; its exact expected stdout is True.

Examples

using System;
using System.Linq;
using System.Threading.Tasks;

Console.WriteLine(4 <= 4);

Result

True

The complete program actually uses `<=`; its exact expected stdout is `True`.

Sources