Esempio n. 1
0
 // Our parameter-less constructor, as needed by the other system.
 public YourClass()
 {
     // Here, we get our concrete adapter. This example is trivial,
     // so nothing more is required, but if you're interested in better
     // software design, I'd recommend checking out the Factory pattern
     // and Inversion of Control libraries, like Ninject or StructureMap!
     _operationPerformer = new UnchangeableAdapter(this);
 }
 // Our parameter-less constructor, as needed by the other system.
 public YourClass()
 {
     // Here, we get our concrete adapter. This example is trivial,
     // so nothing more is required, but if you're interested in better
     // software design, I'd recommend checking out the Factory pattern
     // and Inversion of Control libraries, like Ninject or StructureMap!
     _operationPerformer = new UnchangeableAdapter(this);
 }
Esempio n. 3
0
 public OperationUser(IPerformOperation operationPerformer)
 {
     m_OperationPerformer = operationPerformer;
 }
Esempio n. 4
0
 // We expose this constructor to allow for testing!
 public YourClass(IPerformOperation operationPerformer)
 {
     _operationPerformer = operationPerformer;
 }
 // We expose this constructor to allow for testing!
 public YourClass(IPerformOperation operationPerformer)
 {
     _operationPerformer = operationPerformer;
 }