1:   public class Example
   2:      {
   3:          private DbConnection GetConnection()
   4:          {
   5:              return null;
   6:          }
   7:   
   8:          public void Test()
   9:          {
  10:              // Declare that we need a transaction around this stuff
  11:              using (TransactionScope scope = new TransactionScope())
  12:              {
  13:                  BankAccount bankAccount = new BankAccount();
  14:                  bankAccount.Deposit(50);
  15:                  bankAccount.Withdraw(50);
  16:   
  17:                  // Let the system know the transaction completed successfully
  18:                  scope.Complete();
  19:              }
  20:          }
  21:      }
  22:   
  23:      public class BankAccount
  24:      {
  25:          public void Deposit(int amount)
  26:          {
  27:              // Deposit some money into the account
  28:          }
  29:   
  30:          public void Withdraw(int amount)
  31:          {
  32:              // Withdraw money
  33:          }
  34:      }