using statement vs using declaration
Regarding the following `if (...) { // does NOT work in CS-Script but works in C# 8.0 and up. Note I was using .NET interactive using FileStream f = new FileStream(@"C:\users\jaredpar\using.md"); // statements }
// Is equivalent. This works in CS-Script if (...) { using (FileStream f = new FileStream(@"C:\users\jaredpar\using.md")) { // statements } }`
This can be caused by the script engine using the older version of C# compiler which does not support that new way of declaring using. Though, if you are using the latest >NET SDK and CS-Script then it all is fine:
Update the script:
And now check and execute it:
If you want a faster compilation you can redirect the script engine to the csc.exe C# compiler: