c# 3.0 - coding this function without memory leak! - please advise -


In the following code example, will the filestream and streamreader go away or will they create memory leaks? Is it possible to code this function without leaking memory? Using {{StreamReader sreader = new streamrider (Fstream)} {return sreader.ReadToEnd

  string readfile (string stratum) {(filestream fstream = new FileStream (strpath, FileMode.Open)) (). ToString (); // Note returned here ... so can this be diagnosed after this line? }}}  

thanks

using means of instruction:

  try {var iDisposable = new IDisposable (); // iDisposable use ...} Finally {// settlement of idiotsoz}}  

so yes both fstream and sreader Will be settled.


Comments