public void Foo2() { //Test for thread safety RealModel m = new RealModel(); IModel rm = new DecoratorModel(m); Task.Run(new Action(() => rm.Foo1())); Task.Run(new Action(() => rm.Foo1())); Task.Run(new Action(() => rm.Foo1())); Task.Run(new Action(() => rm.Foo1())); }
public void Foo1() { RealModel m = new RealModel(); IModel rm = new DecoratorModel(m); rm.Foo1(); }