private static bool ArraysEqual(object value1, object value2) { Array array = value1 as Array; Array array2 = value2 as Array; if (array.Length != array2.Length) { return(false); } bool[] array3 = new bool[array2.Length]; for (int i = 0; i < array.Length; i++) { bool flag = false; for (int j = 0; j < array2.Length; j++) { if (!array3[j] && AttributedValue <T> .ValuesEqual(array.GetValue(i), array2.GetValue(j))) { array3[j] = true; flag = true; break; } } if (!flag) { return(false); } } return(true); }
public static void AddToList(List <AttributedValue <T> > list, AttributedValue <T> attributedValue) { if (list == null) { throw new ArgumentNullException("list"); } if (attributedValue == null) { throw new ArgumentNullException("attributedValue"); } bool flag = false; foreach (AttributedValue <T> attributedValue2 in list) { if (AttributedValue <T> .ValuesEqual(attributedValue2.Value, attributedValue.Value)) { flag = true; List <string> list2 = new List <string>(); foreach (string item in attributedValue2.Attributions) { if (!list2.Contains(item)) { list2.Add(item); } } foreach (string item2 in attributedValue.Attributions) { if (!list2.Contains(item2)) { list2.Add(item2); } } attributedValue2.Attributions = list2.ToArray(); break; } } if (!flag) { list.Add(attributedValue); } }
public bool Equals(AttributedValue <T> other) { return(other != null && (object.ReferenceEquals(this, other) || (AttributedValue <T> .ArraysEqual(this.attributions, other.attributions) && AttributedValue <T> .ValuesEqual(this.Value, other.Value)))); }