public bool Equals(IHeaders <TKey, TValue> h2, IHashingStrategy <TValue> valueHashingStrategy) { if (h2.Size != this.size) { return(false); } if (ReferenceEquals(this, h2)) { return(true); } foreach (TKey name in this.Names()) { IList <TValue> otherValues = h2.GetAll(name); IList <TValue> values = this.GetAll(name); if (otherValues.Count != values.Count) { return(false); } for (int i = 0; i < otherValues.Count; i++) { if (!valueHashingStrategy.Equals(otherValues[i], values[i])) { return(false); } } } return(true); }
public static List <string> GetAllAsString <TKey, TValue>(IHeaders <TKey, TValue> headers, TKey name) where TKey : class { IList <TValue> allNames = headers.GetAll(name); var values = new List <string>(); // ReSharper disable once ForCanBeConvertedToForeach // Avoid enumerator allocation for (int i = 0; i < allNames.Count; i++) { TValue value = allNames[i]; values.Add(value?.ToString()); } return(values); }