Last active
August 17, 2020 12:44
-
-
Save atifaziz/2a0291a076c77e197d849eab7c049b1b to your computer and use it in GitHub Desktop.
FileOptions.DeleteOnCode test for my StackOverflow answer https://stackoverflow.com/a/63451070/6682
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
var fileName = Path.GetRandomFileName(); | |
Console.WriteLine($"File name: {fileName}"); | |
Console.WriteLine($"Exists? {File.Exists(fileName)}"); | |
using (var fs = File.Create(fileName, 4096, FileOptions.DeleteOnClose)) | |
Console.WriteLine($"Exists? {File.Exists(fileName)}"); | |
Console.WriteLine($"Exists? {File.Exists(fileName)}"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment