示例#1
0
 /// <inheritdoc/>
 public override bool Equals(byte[] x, byte[] y)
 {
     if (x == y)
     {
         return(true);        // (null, null) or (x, x)
     }
     if (x == null || y == null)
     {
         return(false);                        // (x, null) or (null, y)
     }
     return(MemoryBufferComparer.CompareSpan(x, y) == 0);
 }
示例#2
0
 /// <summary>
 /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
 /// </summary>
 /// <param name="x">The first object to compare.</param>
 /// <param name="y">The second object to compare.</param>
 /// <returns>
 /// A signed integer that indicates the relative values of <paramref name="x" /> and <paramref name="y" />, as shown in the following table.Value Meaning Less than zero<paramref name="x" /> is less than <paramref name="y" />.Zero<paramref name="x" /> equals <paramref name="y" />.Greater than zero<paramref name="x" /> is greater than <paramref name="y" />.
 /// </returns>
 public override int Compare(byte[] x, byte[] y)
 {
     if (x == y)
     {
         return(0);        // (null, null) or (x, x)
     }
     if (x == null)
     {
         return(-1);           // (null, y)
     }
     if (y == null)
     {
         return(1);           // (x, null)
     }
     return(MemoryBufferComparer.CompareSpan(x, y));
 }