Exemplo n.º 1
0
        public void Not_Collect_With_Parameterized_Method()
        {
            var c = new MyWeakClass();

            var w = new WeakDelegate((Action <string>)c.MyMethod, false);

            GC.Collect();

            Assert.IsNotNull(w.Target);
        }
Exemplo n.º 2
0
        public void Not_Collect_With_Method()
        {
            var c = new MyWeakClass();

            var w = new WeakDelegate((Action)c.MySimpleMethod, false);

            GC.Collect();

            Assert.IsNotNull(w.Target);
        }
Exemplo n.º 3
0
        public void KeppAlive_With_Parameterized_Method()
        {
            var c = new MyWeakClass();

            var w = new WeakDelegate((Action <string>)c.MyMethod, true);

            c = null;
            GC.Collect();

            Assert.IsNotNull(w.Target);
        }
Exemplo n.º 4
0
        public void KeepAlive()
        {
            var c = new MyWeakClass();

            var w = new WeakDelegate((Action)c.MySimpleMethod, true);

            c = null;
            GC.Collect();

            Assert.IsNotNull(w.Target);
        }