String.op_Inequality Method
.NET Framework 2.0
Determines whether two specified String objects have different values.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
J# does not support overloaded operators.
JScript supports the use of overloaded operators, but not the declaration of new ones.
Parameters
- a
A String or a null reference (Nothing in Visual Basic).
- b
A String or a null reference (Nothing in Visual Basic).
Return Value
true if the value of a is different from the value of b; otherwise, false.The following code example demonstrates the inequality operator.
// Example for the String Inequality operator. using System; class InequalityOp { public static void Main() { Console.WriteLine( "This example of the String Inequality operator\n" + "generates the following output.\n" ); CompareAndDisplay( "ijkl" ); CompareAndDisplay( "ABCD" ); CompareAndDisplay( "abcd" ); } static void CompareAndDisplay( String Comparand ) { String Lower = "abcd"; Console.WriteLine( "\"{0}\" != \"{1}\" ? {2}", Lower, Comparand, Lower != Comparand ); } } /* This example of the String Inequality operator generates the following output. "abcd" != "ijkl" ? True "abcd" != "ABCD" ? True "abcd" != "abcd" ? False */
// Example for the String Inequality operator.
import System.*;
class InequalityOp
{
public static void main(String[] args)
{
Console.WriteLine(("This example of the String Inequality operator\n"
+ "generates the following output.\n"));
CompareAndDisplay("ijkl");
CompareAndDisplay("ABCD");
CompareAndDisplay("abcd");
} //main
static void CompareAndDisplay(String comparand)
{
String lower = "abcd";
Console.WriteLine("\"{0}\" != \"{1}\" ? {2}", lower, comparand,
System.Convert.ToString(!lower.equals(comparand)));
} //CompareAndDisplay
} //InequalityOp
/*
This example of the String Inequality operator
generates the following output.
"abcd" != "ijkl" ? True
"abcd" != "ABCD" ? True
"abcd" != "abcd" ? False
*/
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.