C# Guid Equals(Object)

Description

Guid Equals(Object) returns a value that indicates whether this instance is equal to a specified object.

Syntax

Guid.Equals(Object) has the following syntax.


public override bool Equals(
  Object o
)

Parameters

Guid.Equals(Object) has the following parameters.

  • o - The object to compare with this instance.

Returns

Guid.Equals(Object) method returns true if o is a Guid that has the same value as this instance; otherwise, false.

Example

The following example demonstrates Equals method.


/* ww w  .  j  a v a 2s. c  om*/

using System;

class Sample 
{
    public static void Main() 
    {
        Guid guidX = new Guid("{CA761232-ED42-11CE-BACD-00AA0057B223}");
        Console.WriteLine(guidX.Equals((object)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