You're trying to either read/open/write or whatever to a stream that's already in use. As said above you have to call Close().
How to avoid it:
Code:
FileStream fs = new FileStream("somefile.txt", FileMode.Open);
StreamReader sr = new StreamReader(fs);
string something = sr.ReadLine();
//Make sure to close the inner-stream first, in this case StreamReader, because it's using FileStream, so you cannot close the FileStream first.
sr.Close();//You need this
fs.Close();//And also this
You could also use the using keyword and avoid using Close().
Code:
using (FileStream fs = new FileStream("somefile.txt", FileMode.Open))
{
using (StreamReader sr = new StreamReader(fs))
{
string something = sr.ReadLine();
}
}