public void ClearWorks()
        {
            var wc = new WeakCollection <string>(10)
            {
                "test"
            };

            wc.Clear();
            Assert.Equal(0, wc.Count);
            Assert.False(wc.Any());
        }
        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());
        }
Exemple #3
0
 private static bool TryEnterMenuMode()
 {
     return(MainMenus.Any(TryEnterItemsControl <Controls.Menu.MenuItem>));
 }