C# Guid Equality
Description
Guid Equality
indicates whether the values of two specified
Guid objects are equal.
Syntax
Guid.Equality
has the following syntax.
public static bool operator ==(
Guid a,
Guid b
)
Parameters
Guid.Equality
has the following parameters.
a
- The first object to compare.b
- The second object to compare.
Returns
Guid.Equality
method returns true if a and b are equal; otherwise, false.
Example
The following example uses the Equality operator to compare two GUID values with Guid.Empty to determine whether they consist exclusively of zeros.
using System;// www . j a v a2s .com
public class Example
{
public static void Main()
{
// Create a GUID and determine whether it consists of all zeros.
Guid guid1 = Guid.NewGuid();
Console.WriteLine(guid1);
Console.WriteLine("Empty: {0}\n", guid1 == Guid.Empty);
}
}
The code above generates the following result.