예제 #1
0
        public void TestCompareMemoryToByteArray()
        {
            byte[] array = new byte[] { 0, 1, 2 };
            ReadOnlyMemory <byte> mem = array.AsMemory();

            Assert.True(mem.Compare(array));
        }
예제 #2
0
 /// <summary>
 /// Compare this <see cref="ReadOnlyMemory{byte}"/> instance to another.
 /// </summary>
 /// <param name="buffer"><see cref="ReadOnlyMemory{byte}"/> instance.</param>
 /// <param name="other"><see cref="ReadOnlyMemory{byte}"/> buffer to compare.</param>
 /// <returns>Returns true if both instances has equal values.</returns>
 public static bool Compare(this ReadOnlyMemory <byte> buffer, ReadOnlyMemory <byte> other)
 {
     return(buffer.Compare(other.ToArray()));
 }