Using
A __using
statement can be used to make sure an object is properly disposed through the IDisposable/Closable interfaces after the code that uses it is finished.
__using let fs = FileStream("textfile.txt", FileMode.Open) {
let b = byte[](123)
fs.Read(b, 0, b.Length)
} // the filestream is closed here.
See Also
- Disposable Pattern
using
keyword in Oxygeneusing
keyword in C#