public void RemoveWorks() { var arr = new[] { "a", "b", "c", "d", "c" }; var wc = new WeakCollection <string>(arr); Assert.True(wc.Remove("c")); Assert.True(wc.OrderBy(x => x).SequenceEqual(new[] { "a", "b", "c", "d" })); Assert.True(wc.Remove("c")); Assert.True(wc.OrderBy(x => x).SequenceEqual(new[] { "a", "b", "d" })); Assert.False(wc.Remove("c")); Assert.True(wc.OrderBy(x => x).SequenceEqual(new[] { "a", "b", "d" })); }
internal static IEnumerable <UIElement> GetSortedNavigableControls() { if (IsCommandNavigationOrderDirty) { var list = NavigableControls.OrderBy(GetCommandNavigationOrder).ToList(); NavigableControls.Clear(); foreach (var uiElement in list) { NavigableControls.Add(uiElement); } IsCommandNavigationOrderDirty = false; } return(NavigableControls); }