Test for equality between stings in CSharp

Description

The following code shows how to test for equality between stings.

Example


  /*ww  w  .j  a v a2  s  . com*/
  
  
     

using System;
using System.Text;

class StringApp {
    static void Main(string[] args) {
        string s1 = "Hello ";
        string s2 = "World!";
        Console.WriteLine("s1 == s2: {0}", s1 == s2);
        Console.WriteLine();

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var