Guid.CompareTo Method (Guid)
Compares this instance to a specified Guid object and returns an indication of their relative values.
Assembly: mscorlib (in mscorlib.dll)
- Type: System.Guid
An object to compare to this instance.
Return ValueType: System.Int32
A signed number indicating the relative values of this instance and value.
A negative integer
This instance is less than value.
This instance is equal to value.
A positive integer
This instance is greater than value.
It compares the Int32 values, and returns a result if they are unequal. If they are equal, it performs the next comparison.
It compares the first Int16 values, and returns a result if they are unequal. If they are equal, it performs the next comparison.
It compares the second Int16 values, and returns a result if they are unequal. If they are equal, it performs the next comparison.
If performs a byte-by-byte comparison of the next eight Byte values. When it encounters the first unequal pair, it returns the result. Otherwise, it returns 0 to indicate that the two Guid values are equal.
Note that the final eight bytes appear in the string representation of a Guid in reverse order, from low byte to high byte. For example, in the string representation of the Guid value "01e75c83-c6f5-4192-b57e-7427cec5560d", the final eight bytes are "b57e-7427cec5560d."
If two GUIDs have equal values for a component, the method compares the next component. When it finds a component whose values are unequal, it returns the result.
.NET FrameworkSupported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
XNA FrameworkSupported in: 3.0, 2.0, 1.0
Portable Class LibrarySupported in: Portable Class Library
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8