internal static bool CopyArrayRank1 <T>(T[] xArray, T[] yArray, CompareContext context) { if (ReferenceEquals(xArray, yArray)) { return(true); } var length = xArray.Length; if (length != yArray.Length) { return(false); } for (var i = 0; i < length; i++) { var x = xArray[i]; var y = yArray[i]; if (context.Skip(x, y) == false) { var result = ComparerGenerator <T> .Compare(x, y, context); if (result == false) { return(false); } } } return(true); }
internal static bool CopyArrayRank2 <T>(T[,] xArray, T[,] yArray, CompareContext context) { if (ReferenceEquals(xArray, yArray)) { return(true); } var lenI = xArray.GetLength(0); var lenJ = xArray.GetLength(1); if (lenI != yArray.GetLength(0) || lenJ != yArray.GetLength(1)) { return(false); } for (var i = 0; i < lenI; i++) { for (var j = 0; j < lenJ; j++) { var x = xArray[i, j]; var y = xArray[i, j]; if (context.Skip(x, y) == false) { var result = ComparerGenerator <T> .Compare(x, y, context); if (result == false) { return(false); } } } } return(true); }
public static bool Compare <T>(T x, T y) { var context = s_context.Value; try { return(ComparerGenerator <T> .Compare(x, y, context)); } finally { context.Reset(); } }
public static bool Compare <T>(T x, T y, CompareContext context) { return(ComparerGenerator <T> .Compare(x, y, context)); }