I am making a simple IO file in MVC6. I added the System.IO NuGet package. However, this gives me a compile-time error. VS IDE does not show a red mark when entering code. The Close() method also appears in intellisense. Please, help!
My code
StreamWriter writer = System.IO.File.CreateText("some_valid_path"); writer.WriteLine("test"); writer.Close();
Mistake
StreamWriter does not contain a definition for "Close", and the "Close" extension method cannot be found that accepts the first argument of the type "StreamWriter" (do you miss the using directive or assembly references?)
Thanks.
asp.net-mvc asp.net-core-mvc
Web dev
source share