Continuously read file with C#

More natural approach of using FileSystemWatcher: var wh = new AutoResetEvent(false); var fsw = new FileSystemWatcher(“.”); fsw.Filter = “file-to-read”; fsw.EnableRaisingEvents = true; fsw.Changed += (s,e) => wh.Set(); var fs = new FileStream(“file-to-read”, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); using (var sr = new StreamReader(fs)) { var s = “”; while (true) { s = sr.ReadLine(); if (s != … Read more

Does the .net framework provides async methods for working with the file-system?

Does the .net framework has an async built-in library/assembly which allows to work with the file system Yes. There are async methods for working with the file system but not for the helper methods on the static File type. They are on FileStream. So, there’s no File.ReadAllBytesAsync but there’s FileStream.ReadAsync, etc. For example: byte[] result; … Read more

techhipbettruvabetnorabahisbahis forumu