| Author: loki 07 Oct 2008 | Member Level: Bronze | Rating: Points: -20 |
Hi,
1 try 2 { 3 // Open I/O source stream 4 try 5 { 6 // Open I/O destination stream 7 try 8 { 9 // Buffer data from source to destination 10 } 11 catch (Exception ex) 12 { 13 // User-friendly feedback - "transfer has failed" 14 } 15 } 16 catch (Exception ex) 17 { 18 // User-friendly feedback - "opening destination stream failed" 19 } 20 finally 21 { 22 // if needed, close destination stream 23 } 24 } 25 catch (Exception ex) 26 { 27 // User-friendly feedback - "opening source stream failed" 28 } 29 finally 30 { 31 // if needed, close source stream 32 }
finally block contains cleanup routines for exception situations.
loki.
|
| Author: Meetu Choudhary 07 Oct 2008 | Member Level: Gold | Rating: Points: 3 |
finally block is executed after the try catch and it is executed whether error occurs or not so the tasks which we like to perform whether the error occurred or not we perform there
-- Thanks and Regards Meetu Choudhary
|