示例#1
0
    public static void DynamicInvoke_CastingDefaultValues()
    {
        {
            // Passing Type.Missing without providing default.
            Delegate d = new DFoo1(Foo1);
            Assert.Throws <ArgumentException>(() => d.DynamicInvoke(7, Type.Missing));
        }

        {
            // Passing Type.Missing with default.
            Delegate d = new DFoo1WithDefault(Foo1);
            d.DynamicInvoke(7, Type.Missing);
        }
    }
示例#2
0
        public static void DynamicInvoke_CastingDefaultValues()
        {
            {
                // Passing Type.Missing without providing default.
                Delegate d = new DFoo1(Foo1);
                Assert.Throws<ArgumentException>(() => d.DynamicInvoke(7, Type.Missing));
            }

            {
                // Passing Type.Missing with default.
                Delegate d = new DFoo1WithDefault(Foo1);
                d.DynamicInvoke(7, Type.Missing);
            }
        }