- We have two ways to clean up utilized resources in C# either we can use try..catch..finally statements series or we can use the using statement in C#
- The thing is that resources should be released and cleanup must be performed either before exitting the using block or just entering up the finally block.
- Use using Statement in C# to release up the resources when the creating type implements the IDisposable interface.
- Use try..catch..finally when we need to perform cleanup but not necessarily employ the Dispose Method.
Monday, September 29, 2008
When to use using and when to use try catch to do the cleaning