How to

dispose object

Published: 31. October 2011 | Updated: 31. October 2011
License: Microsoft Public License (MS-PL)
Categories: Framework » Basics
Tags: Basics C# Design Patterns
Was this snippet helpful for you? YESYES / NONO
using (Stream stream = File.Open("...", FileMode.Open))
{
    // ...

} // in the end of a using statement is object disposed

// or

Stream stream = File.Open("...", FileMode.Open);
stream.Dispose();
Send us feedback about this snippet »



Related Snippets: