Thursday 4 February 2016

ASP.NET Tips #78 - Dispose of unmanaged resources

File I/O, network resources, database connections, etc, should be disposed of once their usage is complete, rather than waiting for the Garbage Collector to handle them. This can take anything from milliseconds to minutes, depending on the rate you consume memory in your code. If you don't use a lot of, it will take a long time.

These types of resources typically implement the IDisposable interface so that unmanaged resources can be released once use of the object is complete.

Ideally, use a 'using' {...} block to automatically dispose the object once out of scope, or ensure you manually call Dispose().

For more information, see: https://msdn.microsoft.com/en-us/library/498928w2.aspx

1 comment :

  1. Excellent blog post. I would like to express thank you for motivating and useful information and I like your point of analysis. Thank you! I love to read this type of material good and attractive information I take from it. Thank you for posting such a fine article.
    custom essay writing service

    ReplyDelete