public void Write() { writeLocker.Wait(); try { StoreStream.SetLength(0); var sw = new StreamWriter(StoreStream); foreach (var item in Lines.Skip(SkipCount).Distinct()) { sw.WriteLine(item); } } finally { writeLocker.Release(); } }
public async Task WriteAsync() { await writeLocker.WaitAsync(); try { StoreStream.SetLength(0); var sw = new StreamWriter(StoreStream); foreach (var item in Lines.Skip(SkipCount).Distinct()) { await sw.WriteLineAsync(item); } } finally { writeLocker.Release(); } }