Esempio n. 1
0
        public void ClearWorks()
        {
            var wc = new WeakCollection <string>(10)
            {
                "test"
            };

            wc.Clear();
            Assert.Equal(0, wc.Count);
            Assert.False(wc.Any());
        }
Esempio n. 2
0
        public void ClearWorksAfterCollect()
        {
            var wc = new WeakCollection <string>();

            {
                var a = new string('a', 1);
                wc.Add(a);
                Assert.Equal("a", wc.First());
            }
            GCEx.CollectAndWait();
            wc.Clear();
            Assert.Equal(0, wc.CapCount);
            Assert.False(wc.Any());
        }
Esempio n. 3
0
 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);
 }