Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

!=: practical reference

!=: practical reference: != negates the equality semantics of the operator defined for the type.

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

Syntax

left != right

!= negates the equality semantics of the operator defined for the type.

Use it consistently with == and Equals.

A user-defined type should overload == and != together, and null may invoke an overload.

NaN != NaN is true, while reference comparison can depend on static type and operator selection.

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

Examples

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

Console.WriteLine(3 != 4);

Result

True

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

Sources