[Enter feedback here]
Documentation indicates that IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) returns -1, 0, or 1. This is incorrect. It can return any number less than zero if current instance precedes other, and any number greater than zero if current instance follows other.
var val1 = new byte[] { 0, 55, };
var val2 = new byte[] { 0, 99, };
var comp = ((IStructuralComparable)val1).CompareTo(val2, Comparer<byte>.Default);
Console.WriteLine(comp); // writes -44, not -1
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: 875e11d9-d3e8-71fa-9068-04762037896e
Version Independent ID: 5662d353-4f93-21f9-bc0a-c5dc586e7cc7
[Enter feedback here] Documentation indicates that
IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer)
returns -1, 0, or 1. This is incorrect. It can return any number less than zero if current instance precedesother
, and any number greater than zero if current instance followsother
.Compare to correct documentation here for IComparable.CompareTo().
Simple test case:
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.