Compare to var variables in CSharp

Description

The following code shows how to compare to var variables.

Example


using System;/*from   ww  w. j  a v a  2 s  .c o  m*/
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {
        var wordsA = new string[] { "c", "ap", "b" };
        var wordsB = new string[] { "c", "ap", "b" };

        bool match = wordsA.Equals(wordsB);

        Console.WriteLine("The sequences match: {0}", match);
    }
}

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