public static int Compare <T>(IList <T> source, int sourceIndex, IList <T> destination, int destinationIndex, int length) { { var x = source as byte[]; var y = destination as byte[]; if (x != null && y != null) { if (0 > (source.Count - sourceIndex)) { throw new ArgumentOutOfRangeException("sourceIndex"); } if (0 > (destination.Count - destinationIndex)) { throw new ArgumentOutOfRangeException("destinationIndex"); } if (length > (source.Count - sourceIndex)) { throw new ArgumentOutOfRangeException("length"); } if (length > (destination.Count - destinationIndex)) { throw new ArgumentOutOfRangeException("length"); } return(Unsafe.Compare(x, sourceIndex, y, destinationIndex, length)); } } { var compare = Comparer <T> .Default; return(CollectionUtilities.Compare(source, sourceIndex, destination, destinationIndex, length, compare)); } }
public static int Compare <T>(IList <T> source, IList <T> destination) { { var x = source as byte[]; var y = destination as byte[]; if (x != null && y != null) { return(Unsafe.Compare(x, y)); } } { var compare = Comparer <T> .Default; return(CollectionUtilities.Compare(source, destination, compare)); } }