好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

AOP初步试验

AOP初步试验


[System.Runtime.Remoting.Contexts.Synchronization()]

public class Calc: ContextBoundObject
{
  public Calc()
  {
    Console.WriteLine("Calc(): " + Thread.CurrentContext);
  }

  public int Add( int x, int y)
  {
    Console.WriteLine("Add: " + Thread.CurrentContext);
    return x + y;
  }
}

 

public class Application
{
  public static void Main()
  {

    Console.WriteLine("Main: " + Thread.CurrentContext);

    Assert.AreEqual(3, new Calc().Add(1, 2));
  }

}


查看更多关于AOP初步试验的详细内容...

  阅读:42次