C# String Inequality

Description

String Inequality determines whether two specified strings have different values.

Syntax

String.Inequality has the following syntax.


public static bool operator !=(
  string a,
  string b
)

Parameters

String.Inequality has the following parameters.

  • a - The first string to compare, or null.
  • b - The second string to compare, or null.

Returns

String.Inequality method returns true if the value of a is different from the value of b; otherwise, false.

Example

The following example demonstrates the inequality operator.


/*from  w w  w  .  j av  a 2s. c o m*/
using System;

class EqualityOp 
{
    public static void Main() 
    {

        String  Lower = "abcd";

        Console.WriteLine( Lower != "abcd");
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version