using System; using System.Threading; namespace KattekerCreator.Helper { public class TemporaryDirectory : IDisposable { public string Path { get; } public TemporaryDirectory(string path) { Path = path; } void IDisposable.Dispose() { try { Thread.Sleep(100); System.IO.Directory.Delete(Path, true); } catch { //ignore. } } } }