Reputation: 1585
I am using a System::IO::StreamWriter. My intention is to check if the file in use is open, and close it.
What is the correct way of checking if the file is in use. I keep getting System.NullReferenceException with the code below.
if (filewr2->BaseStream != nullptr)
{
filewr2->Close();
filewr2 = nullptr;
}
Upvotes: 0
Views: 30