コード例 #1
0
ファイル: Delegate.cs プロジェクト: giagiigi/corefx
    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
ファイル: DelegateTests.cs プロジェクト: SGuyGe/corefx
        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);
            }
        }