Example #1
0
 private static bool nullable <valueType>(Nullable <valueType> left, Nullable <valueType> right) where valueType : struct
 {
     if (left.HasValue)
     {
         return(right.HasValue && Comparor <valueType> .Equals(left.Value, right.Value));
     }
     return(!right.HasValue);
 }
Example #2
0
 private static bool leftArray <valueType>(LeftArray <valueType> leftArray, LeftArray <valueType> rightArray)
 {
     if (leftArray.Length == rightArray.Length)
     {
         for (int index = leftArray.Length; index != 0;)
         {
             --index;
             if (!Comparor <valueType> .Equals(leftArray[index], rightArray[index]))
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Example #3
0
 private static bool dictionary <dictionaryType, keyType, valueType>(dictionaryType leftArray, dictionaryType rightArray) where dictionaryType : IDictionary <keyType, valueType>
 {
     if (Object.ReferenceEquals(leftArray, rightArray))
     {
         return(true);
     }
     if (leftArray != null && rightArray != null && leftArray.Count == rightArray.Count)
     {
         foreach (KeyValuePair <keyType, valueType> left in leftArray)
         {
             valueType right;
             if (!rightArray.TryGetValue(left.Key, out right) || !Comparor <valueType> .Equals(left.Value, right))
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Example #4
0
 private static bool collection <valueType, argumentType>(valueType leftArray, valueType rightArray) where valueType : IEnumerable <argumentType>, ICollection
 {
     if (Object.ReferenceEquals(leftArray, rightArray))
     {
         return(true);
     }
     if (leftArray != null && rightArray != null && leftArray.Count == rightArray.Count)
     {
         IEnumerator <argumentType> right = rightArray.GetEnumerator();
         foreach (argumentType left in leftArray)
         {
             if (!right.MoveNext() || !Comparor <argumentType> .Equals(left, right.Current))
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Example #5
0
 private static bool listArray <valueType>(ListArray <valueType> leftArray, ListArray <valueType> rightArray)
 {
     if (Object.ReferenceEquals(leftArray, rightArray))
     {
         return(true);
     }
     if (leftArray != null && rightArray != null && leftArray.Length == rightArray.Length)
     {
         for (int index = leftArray.Length; index != 0;)
         {
             --index;
             if (!Comparor <valueType> .Equals(leftArray[index], rightArray[index]))
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Example #6
0
 private static bool array <valueType>(valueType[] leftArray, valueType[] rightArray)
 {
     if (Object.ReferenceEquals(leftArray, rightArray))
     {
         return(true);
     }
     if (leftArray != null && rightArray != null && leftArray.Length == rightArray.Length)
     {
         int index = 0;
         foreach (valueType left in leftArray)
         {
             if (!Comparor <valueType> .Equals(left, rightArray[index++]))
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }