G
Guest
Using the following code, I get a System.ObjectdisposedException. The message
is "Cannot write to a closed TextWriter."
What is wrong?
using System;
using System.IO;
namespace Test {
class Test {
public static void Main() {
using (StreamWriter sw = new StreamWriter("c:\\TestFile.txt")) {
sw.WriteLine("Testing.");
sw.Flush();
}
}
}
}
is "Cannot write to a closed TextWriter."
What is wrong?
using System;
using System.IO;
namespace Test {
class Test {
public static void Main() {
using (StreamWriter sw = new StreamWriter("c:\\TestFile.txt")) {
sw.WriteLine("Testing.");
sw.Flush();
}
}
}
}