コード例 #1
0
    public void TestAsyncCallWithValueTypesByRef()
    {
        Point            x, y, result;
        IAsyncResult     ar;
        PointByRefMethod m = new PointByRefMethod(PointByRefAdd);

        x = new Point(10, 20);
        y = new Point(30, 40);

        ar = m.BeginInvoke(ref x, ref y, null, null);

        result = m.EndInvoke(ref x, ref y, ar);

        AssertEquals("x=(30,40)", new Point(30, 40), x);
        AssertEquals("y=(10,20)", new Point(10, 20), y);
        AssertEquals("result==Point(40, 60)", new Point(40, 60), result);
    }
コード例 #2
0
	public void TestAsyncCallWithValueTypesByRef()
	{
		Point x, y, result;
		IAsyncResult ar;
		PointByRefMethod m = new PointByRefMethod(PointByRefAdd);
		
		x = new Point(10, 20);
		y = new Point(30, 40);
		
		ar = m.BeginInvoke(ref x, ref y, null, null);
		
		result = m.EndInvoke(ref x, ref y, ar);
		
		AssertEquals("x=(30,40)", new Point(30, 40), x);
		AssertEquals("y=(10,20)", new Point(10, 20), y);
		AssertEquals("result==Point(40, 60)", new Point(40, 60), result);
	}