!= Operator (C# Reference)
The inequality operator
true if its operands are not equal,
false otherwise. For the operands of the built-in types, the expression
x != y produces the same result as the expression
!(x == y). For more information, see the == Operator article.
The following example demonstrates the usage of the
int a = 1 + 1 + 2 + 3; int b = 6; Console.WriteLine(a != b); // output: True string s1 = "Hello"; string s2 = "Hello"; Console.WriteLine(s1 != s2); // output: False object o1 = 1; object o2 = 1; Console.WriteLine(o1 != o2); // output: True
C# language specification
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.