C# Guid Equals(Guid)

Description

Guid Equals(Guid) returns a value indicating whether this instance and a specified Guid object represent the same value.

Syntax

Guid.Equals(Guid) has the following syntax.


public bool Equals(
  Guid g
)

Parameters

Guid.Equals(Guid) has the following parameters.

  • g - An object to compare to this instance.

Returns

Guid.Equals(Guid) method returns true if g is equal to this instance; otherwise, false.

Example

The following example demonstrates Equals method.


//w w  w  . ja  v  a  2 s . co  m

using System;

class Sample 
{
    public static void Main() 
    {
        Guid guidX = new Guid("{CA761232-ED42-11CE-BACD-00AA0057B223}");
        Console.WriteLine(guidX.Equals(new Guid("{CA761232-ED42-11CE-BACD-00AA0057B224}")));
    }
}

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