Created
April 25, 2016 17:57
-
-
Save kellyelton/219c19e43081b5ccff05fcc7605235d8 to your computer and use it in GitHub Desktop.
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
public static void Main(string[] args){ | |
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "tester.txt"); | |
using(var eve = new AutoResetEvent(false)) | |
using(var file = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.Delete)){ | |
Task.Run(()=>{ | |
File.Delete(path); | |
if(File.Exists(path)) | |
Console.WriteLine("File Exists"); | |
eve.Set(); | |
}); | |
eve.WaitOne(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment