Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 0.50 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Return value of parameterized methods?
  2. bool inputOk = ReadAndValidateInput(out customerName, out seatPrice);
  3.  
  4. private bool ReadAndValidateInput(out string name, out double price)
  5.        
  6. double discount = 0;
  7.  
  8. if(ReadAndValidateInput(customerName, seatPrice, out discount))
  9. {
  10.    //do something with discount. You know that input was valid
  11. }
  12. else
  13. {  // do not touch discount. User has not entered valid values
  14. }
  15.        
  16. string name;
  17. double price;
  18. bool inputOk = ReadAndValidateInput(out customerName, out seatPrice);