コード例 #1
0
    static int Main()
    {
        R1  myobj = new R1();
        int res   = 0;

        MyProxy real_proxy = new MyProxy(myobj);

        R1 o = (R1)real_proxy.GetTransparentProxy();

        RemoteDelegate1 d1 = new RemoteDelegate1(o.Add);

        IAsyncResult ar    = d1.BeginInvoke(2, out res, 3, null, null);
        MyStruct     myres = d1.EndInvoke(out res, ar);

        Console.WriteLine("Result: " + myres.a + " " +
                          myres.b + " " + myres.c + " " + res);
        if (myres.a != 2)
        {
            return(1);
        }

        if (myres.b != 3)
        {
            return(2);
        }

        if (myres.c != 5)
        {
            return(3);
        }

        if (res != 5)
        {
            return(4);
        }

        return(0);
    }
コード例 #2
0
 static int Main()
 {
     R1
     myobj
     =
     new
     R1
     ();
     int
     res
     =
     0;
     MyProxy
     real_proxy
     =
     new
     MyProxy
     (myobj);
     R1
     o
     =
     (R1)real_proxy.GetTransparentProxy
     ();
     RemoteDelegate1
     d1
     =
     new
     RemoteDelegate1
     (o.Add);
     IAsyncResult
     ar
     =
     d1.BeginInvoke
     (2,
     out
     res,
     3,
     null,
     null);
     MyStruct
     myres
     =
     d1.EndInvoke
     (out
     res,
     ar);
     Console.WriteLine
     ("Result: "
     +
     myres.a
     +
     " "
     +
     myres.b
     +
     " "
     +
     myres.c
     +
     " "
     +
     res);
     if
     (myres.a
     !=
     2)
     return
     1;
     if
     (myres.b
     !=
     3)
     return
     2;
     if
     (myres.c
     !=
     5)
     return
     3;
     if
     (res
     !=
     5)
     return
     4;
     return
     0;
 }