# BigInteger.Inequality Operator

## Definition

Important

Some information relates to prerelease product that may be substantially modified before itâ€™s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Returns a value that indicates whether two numeric values are not equal.

## Overloads

Inequality(Int64, BigInteger) |
Returns a value that indicates whether a 64-bit signed integer and a BigInteger value are not equal. |

Inequality(BigInteger, Int64) |
Returns a value that indicates whether a BigInteger value and a 64-bit signed integer are not equal. |

Inequality(BigInteger, BigInteger) |
Returns a value that indicates whether two BigInteger objects have different values. |

Inequality(BigInteger, UInt64) |
Returns a value that indicates whether a BigInteger value and a 64-bit unsigned integer are not equal. |

Inequality(UInt64, BigInteger) |
Returns a value that indicates whether a 64-bit unsigned integer and a BigInteger value are not equal. |

## Inequality(Int64, BigInteger)

- Source:
- BigInteger.cs

- Source:
- BigInteger.cs

- Source:
- BigInteger.cs

Returns a value that indicates whether a 64-bit signed integer and a BigInteger value are not equal.

```
public:
static bool operator !=(long left, System::Numerics::BigInteger right);
```

`public static bool operator != (long left, System.Numerics.BigInteger right);`

`static member op_Inequality : int64 * System.Numerics.BigInteger -> bool`

`Public Shared Operator != (left As Long, right As BigInteger) As Boolean`

#### Parameters

- left
- Int64

The first value to compare.

- right
- BigInteger

The second value to compare.

#### Returns

`true`

if `left`

and `right`

are not equal; otherwise, `false`

.

### Remarks

The Inequality method defines the operation of the inequality operator for BigInteger values. It enables code such as the following:

```
BigInteger bigNumber = BigInteger.Pow(2, 63);
long number = Int64.MaxValue;
if (number != bigNumber)
{
// Do something...
}
```

```
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63)
Dim number As Long = Int64.MaxValue
If number <> bigNumber Then
' Do something...
End If
```

Languages that do not support custom operators can test for inequality by using one of the following techniques:

Calling the BigInteger.CompareTo(Int64) instance method, which indicates the relationship between a BigInteger and a signed long integer value.

Calling the BigInteger.Equals(Int64) instance method and reversing its value.

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.

### See also

### Applies to

## Inequality(BigInteger, Int64)

- Source:
- BigInteger.cs

- Source:
- BigInteger.cs

- Source:
- BigInteger.cs

Returns a value that indicates whether a BigInteger value and a 64-bit signed integer are not equal.

```
public:
static bool operator !=(System::Numerics::BigInteger left, long right);
```

`public static bool operator != (System.Numerics.BigInteger left, long right);`

`static member op_Inequality : System.Numerics.BigInteger * int64 -> bool`

`Public Shared Operator != (left As BigInteger, right As Long) As Boolean`

#### Parameters

- left
- BigInteger

The first value to compare.

- right
- Int64

The second value to compare.

#### Returns

`true`

if `left`

and `right`

are not equal; otherwise, `false`

.

### Remarks

The Inequality method defines the operation of the inequality operator for BigInteger values. It enables code such as the following:

```
BigInteger bigNumber = BigInteger.Pow(2, 63);
long number = Int64.MaxValue;
if (bigNumber != number)
{
// Do something...
}
```

```
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63)
Dim number As Long = Int64.MaxValue
If bigNumber <> number Then
' Do something...
End If
```

Languages that do not support custom operators can test for inequality by using one of the following techniques:

Calling the BigInteger.CompareTo(Int64) method, which indicates the relationship between a BigInteger and a signed long integer value.

Calling the BigInteger.Equals(Int64) method and reversing its value.

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

## Inequality(BigInteger, BigInteger)

- Source:
- BigInteger.cs

- Source:
- BigInteger.cs

- Source:
- BigInteger.cs

Returns a value that indicates whether two BigInteger objects have different values.

```
public:
static bool operator !=(System::Numerics::BigInteger left, System::Numerics::BigInteger right);
```

```
public:
static bool operator !=(System::Numerics::BigInteger left, System::Numerics::BigInteger right) = System::Numerics::IEqualityOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, bool>::op_Inequality;
```

`public static bool operator != (System.Numerics.BigInteger left, System.Numerics.BigInteger right);`

`static member op_Inequality : System.Numerics.BigInteger * System.Numerics.BigInteger -> bool`

`Public Shared Operator != (left As BigInteger, right As BigInteger) As Boolean`

#### Parameters

- left
- BigInteger

The first value to compare.

- right
- BigInteger

The second value to compare.

#### Returns

`true`

if `left`

and `right`

are not equal; otherwise, `false`

.

#### Implements

### Remarks

The Inequality method defines the operation of the inequality operator for BigInteger values. It enables code such as the following:

```
BigInteger number1 = 945834723;
BigInteger number2 = 345145625;
BigInteger number3 = 945834723;
Console.WriteLine(number1 != number2); // Displays True
Console.WriteLine(number1 != number3); // Displays False
```

```
Dim number1 As BigInteger = 945834723
Dim number2 As BigInteger = 345145625
Dim number3 As BigInteger = 945834723
Console.WriteLine(number1 <> number2) ' Displays True
Console.WriteLine(number1 <> number3) ' Displays False
```

Languages that do not support custom operators can test for inequality by using one of the following techniques:

Calling the BigInteger.Compare method, which indicates the relationship between two BigInteger objects.

Calling the BigInteger.Equals(BigInteger) method and reversing its value.

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

### See also

### Applies to

## Inequality(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 and a 64-bit unsigned integer are not equal.

```
public:
static bool operator !=(System::Numerics::BigInteger left, System::UInt64 right);
```

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

```
[<System.CLSCompliant(false)>]
static member op_Inequality : System.Numerics.BigInteger * uint64 -> bool
```

`Public Shared Operator != (left As BigInteger, right As ULong) As Boolean`

#### Parameters

- left
- BigInteger

The first value to compare.

- right
- UInt64

The second value to compare.

#### Returns

`true`

if `left`

and `right`

are not equal; otherwise, `false`

.

- Attributes

### Remarks

```
BigInteger bigNumber = BigInteger.Pow(2, 63) - BigInteger.One;
ulong uNumber = Int64.MaxValue & 0x7FFFFFFFFFFFFFFF;
if (bigNumber != uNumber)
{
// Do something...
}
```

```
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63) - BigInteger.One
Dim uNumber As ULong = CULng(Int64.MaxValue And CULng(&h7FFFFFFFFFFFFFFF))
If bigNumber <> uNumber Then
' Do something...
End If
```

Calling the BigInteger.CompareTo(UInt64) method, which indicates the relationship between a BigInteger and an unsigned long integer value.

Calling the BigInteger.Equals(UInt64) method and reversing its value.

### See also

### Applies to

## Inequality(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 and a BigInteger value are not equal.

```
public:
static bool operator !=(System::UInt64 left, System::Numerics::BigInteger right);
```

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

```
[<System.CLSCompliant(false)>]
static member op_Inequality : uint64 * System.Numerics.BigInteger -> bool
```

`Public Shared Operator != (left As ULong, right As BigInteger) As Boolean`

#### Parameters

- left
- UInt64

The first value to compare.

- right
- BigInteger

The second value to compare.

#### Returns

`true`

if `left`

and `right`

are not equal; otherwise, `false`

.

- Attributes

### Remarks

```
BigInteger bigNumber = BigInteger.Pow(2, 63) - BigInteger.One;
ulong uNumber = Int64.MaxValue & 0x7FFFFFFFFFFFFFFF;
if (uNumber != bigNumber)
{
// Do something...
}
```

```
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63) - BigInteger.One
Dim uNumber As ULong = CULng(Int64.MaxValue And CULng(&h7FFFFFFFFFFFFFFF))
If uNumber <> bigNumber Then
' Do something...
End If
```

Calling the BigInteger.CompareTo(UInt64) method, which indicates the relationship between a BigInteger and an unsigned long integer value.

Calling the BigInteger.Equals(UInt64) method and reversing its value.

### See also

### Applies to

## Feedback

https://aka.ms/ContentUserFeedback.

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for