Hello,
In the following code example,will filestream and streamreader get disposed or will they create memory leaks? Is it possible to code this function without causing memory leaks?
string ReadFile(string strPath)
{
using (FileStream fstream = new FileStream(strPath, FileMode.Open))
{
using (StreamReader sreader = new StreamReader(fstream))
{
return sreader.ReadToEnd().ToString(); //NOTE ITS RETURNED HERE...SO CAN IT GET DISPOSED AFTER THIS LINE?
}
}
}
Thanks