private void AssertCollectionsAreEquivalent() { if (this._sourceCollection.Count != this._descriptionCollection.Count) { // Collections may not be equivalent if a descriptor isn't fully defined return; } Debug.Assert(SortCollectionManager.AreEquivalent(this._descriptionCollection, this._sourceCollection), "Collections should be equal."); }
/// <summary> /// Determines whether the <paramref name="sortDescriptions"/> are equivalent to the <paramref name="sortDescriptors"/>. /// </summary> /// <param name="sortDescriptions">The descriptions to compare</param> /// <param name="sortDescriptors">The descriptors to compare</param> /// <returns><c>true</c> if the collections are equivalent</returns> public static bool AreEquivalent(SortDescriptionCollection sortDescriptions, SortDescriptorCollection sortDescriptors) { Debug.Assert((sortDescriptions != null) && (sortDescriptors != null), "Both should be non-null."); if (sortDescriptions.Count != sortDescriptors.Count) { return(false); } for (int i = 0, count = sortDescriptions.Count; i < count; i++) { if (!SortCollectionManager.AreEquivalent(sortDescriptions[i], sortDescriptors[i])) { return(false); } } return(true); }