1 namespace System.Activities.Presentation.Internal {
3 using System.Diagnostics;
7 // An EqualityArray is an array of objects whose
8 // .Equals method runs against all items in the
9 // array. It is assumed that the data input
10 // into the array is constant. We use this in attributes
11 // to offer a quick and accurate TypeId property.
13 internal class EqualityArray {
14 private object[] _values;
16 internal EqualityArray(params object[] values) {
18 Fx.Assert(_values != null && _values.Length > 0, "EqualityArray expects at least one value");
21 public override bool Equals(object other) {
22 EqualityArray otherArray = other as EqualityArray;
23 if (otherArray == null) return false;
24 if (otherArray._values.Length != _values.Length) return false;
25 for (int idx = 0; idx < _values.Length; idx++) {
26 if (_values[idx] != otherArray._values[idx]) return false;
31 public override int GetHashCode() {
32 return _values[0].GetHashCode();