BigInteger.LessThanOrEqual Operator

Definition

Returns a value that indicates whether a specified value is less than or equal to another specified value.

Overloads

LessThanOrEqual(Int64, BigInteger)

Returns a value that indicates whether a 64-bit signed integer is less than or equal to a BigInteger value.

LessThanOrEqual(BigInteger, Int64)

Returns a value that indicates whether a BigInteger value is less than or equal to a 64-bit signed integer.

LessThanOrEqual(BigInteger, BigInteger)

Returns a value that indicates whether a BigInteger value is less than or equal to another BigInteger value.

LessThanOrEqual(BigInteger, UInt64)

Returns a value that indicates whether a BigInteger value is less than or equal to a 64-bit unsigned integer.

LessThanOrEqual(UInt64, BigInteger)

Returns a value that indicates whether a 64-bit unsigned integer is less than or equal to a BigInteger value.

LessThanOrEqual(Int64, BigInteger)

Source:
BigInteger.cs
Source:
BigInteger.cs
Source:
BigInteger.cs

Returns a value that indicates whether a 64-bit signed integer is less than or equal to a BigInteger value.

C#
public static bool operator <=(long left, System.Numerics.BigInteger right);

Parameters

left
Int64

The first value to compare.

right
BigInteger

The second value to compare.

Returns

true if left is less than or equal to right; otherwise, false.

Remarks

The LessThanOrEqual method defines the operation of the less than or equal to operator for BigInteger values. It enables code such as the following:

C#
BigInteger number = BigInteger.Parse("9801324316220166912");
if (Int64.MaxValue <= number)
{
   // Do something.
}
else
{
   // Do something else.
}

Languages that do not support custom operators can call the BigInteger.CompareTo(Int64) method instead. They can also call the LessThanOrEqual(Int64, BigInteger) method directly, as the following example shows.

VB
Dim number As BigInteger = BigInteger.Parse("9801324316220166912")
If BigInteger.op_LessThanOrEqual(Int64.MaxValue, number) Then
   ' Do something.
Else
   ' Do something else.
End If

If left is a Byte, Int16, Int32, SByte, UInt16, or UInt32 value, it is implicitly converted to an Int64 value when the operation is performed.

The equivalent method for this operator is BigInteger.CompareTo(Int64).

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

LessThanOrEqual(BigInteger, Int64)

Source:
BigInteger.cs
Source:
BigInteger.cs
Source:
BigInteger.cs

Returns a value that indicates whether a BigInteger value is less than or equal to a 64-bit signed integer.

C#
public static bool operator <=(System.Numerics.BigInteger left, long right);

Parameters

left
BigInteger

The first value to compare.

right
Int64

The second value to compare.

Returns

true if left is less than or equal to right; otherwise, false.

Remarks

The LessThanOrEqual method defines the operation of the less than or equal to operator for BigInteger values. It enables code such as the following:

C#
BigInteger number = BigInteger.Parse("9801324316220166912");
if (number <= Int64.MaxValue)
{
   // Do something.
}
else
{
   // Do something else.
}

Languages that do not support custom operators can call the BigInteger.CompareTo(Int64) method instead. They can also call the LessThanOrEqual(BigInteger, Int64) method directly, as the following example shows.

VB
Dim number As BigInteger = BigInteger.Parse("9801324316220166912")
If BigInteger.op_LessThanOrEqual(number, Int64.MaxValue) Then
   ' Do something.
Else
   ' Do something else.
End If

If right is a Byte, Int16, Int32, SByte, UInt16, or UInt32 value, it is implicitly converted to an Int64 value when the operation is performed.

The equivalent method for this operator is BigInteger.CompareTo(Int64).

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

LessThanOrEqual(BigInteger, BigInteger)

Source:
BigInteger.cs
Source:
BigInteger.cs
Source:
BigInteger.cs

Returns a value that indicates whether a BigInteger value is less than or equal to another BigInteger value.

C#
public static bool operator <=(System.Numerics.BigInteger left, System.Numerics.BigInteger right);

Parameters

left
BigInteger

The first value to compare.

right
BigInteger

The second value to compare.

Returns

true if left is less than or equal to right; otherwise, false.

Implements

Remarks

The LessThanOrEqual method defines the operation of the less than or equal to operator for BigInteger values. It enables code such as the following:

C#
BigInteger number1 = 945834723;
BigInteger number2 = 345145625;
BigInteger number3 = 945834724;
BigInteger number4 = 945834723;
Console.WriteLine(number1 <= number2);             // Displays False
Console.WriteLine(number1 <= number3);             // Displays True
Console.WriteLine(number1 <= number4);             // Displays True

Languages that do not support custom operators can call the Compare method instead. They can also call the LessThanOrEqual(BigInteger, BigInteger) method directly, as the following example shows.

VB
Dim numberA As BigInteger = 945834723
Dim numberB As BigInteger = 345145625
Dim numberC As BigInteger = 945834724 
Dim numberD As BigInteger = 945834723
Console.WriteLine( _
        BigInteger.op_LessThanOrEqual(numberA, numberB))    ' Displays False
Console.WriteLine( _
        BigInteger.op_LessThanOrEqual(numberA, numberC))    ' Displays True
Console.WriteLine( _
        BigInteger.op_LessThanOrEqual(numberA, numberD))    ' Displays True

The equivalent method for this operator is BigInteger.Compare(BigInteger, BigInteger).

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

LessThanOrEqual(BigInteger, UInt64)

Source:
BigInteger.cs
Source:
BigInteger.cs
Source:
BigInteger.cs

Important

This API is not CLS-compliant.

Returns a value that indicates whether a BigInteger value is less than or equal to a 64-bit unsigned integer.

C#
[System.CLSCompliant(false)]
public static bool operator <=(System.Numerics.BigInteger left, ulong right);

Parameters

left
BigInteger

The first value to compare.

right
UInt64

The second value to compare.

Returns

true if left is less than or equal to right; otherwise, false.

Attributes

Remarks

The LessThanOrEqual method defines the operation of the less than or equal to operator for BigInteger values. It enables code such as the following:

C#
BigInteger number = BigInteger.Parse("19801324316220166912");
if (number <= UInt64.MaxValue)
{
   // Do something.
}
else
{
   // Do something else.
}

Languages that do not support custom operators can call the BigInteger.CompareTo(UInt64) method instead. They can also call the LessThanOrEqual(BigInteger, UInt64) method directly, as the following example shows.

VB
Dim number As BigInteger = BigInteger.Parse("19801324316220166912")
If BigInteger.op_LessThanOrEqual(number, UInt64.MaxValue) Then
   ' Do something.
Else
   ' Do something else.
End If

The equivalent method for this operator is BigInteger.CompareTo(UInt64).

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

LessThanOrEqual(UInt64, BigInteger)

Source:
BigInteger.cs
Source:
BigInteger.cs
Source:
BigInteger.cs

Important

This API is not CLS-compliant.

Returns a value that indicates whether a 64-bit unsigned integer is less than or equal to a BigInteger value.

C#
[System.CLSCompliant(false)]
public static bool operator <=(ulong left, System.Numerics.BigInteger right);

Parameters

left
UInt64

The first value to compare.

right
BigInteger

The second value to compare.

Returns

true if left is less than or equal to right; otherwise, false.

Attributes

Remarks

The LessThanOrEqual method defines the operation of the less than or equal to operator for BigInteger values. It enables code such as the following:

C#
BigInteger number = BigInteger.Parse("9801324316220166912");
if (UInt64.MaxValue <= number)
{
   // Do something.
}
else
{
   // Do something else.
}

Languages that do not support custom operators can call the BigInteger.CompareTo(UInt64) method instead. They can also call the LessThanOrEqual(UInt64, BigInteger) method directly, as the following example shows.

VB
Dim number As BigInteger = BigInteger.Parse("9801324316220166912")
If BigInteger.op_LessThanOrEqual(UInt64.MaxValue, number) Then
   ' Do something.
Else
   ' Do something else.
End If

The equivalent method for this operator is BigInteger.CompareTo(UInt64).

See also

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0