示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }