c# - FileStream Cannot Access File Because It is Being Used by Another Process -
i have looked @ number of different posts, including the process cannot access file because being used process , ioexception: process cannot access file 'file path' because being used process , , better way of invoking thread , logging text file in c# i might missing simple, reason cannot figure out how safely write file in async method. making call web api, , when response comes in, want write file. code follows: static class program { private static object locker = new object(); static void main() { string line; streamreader reader = new streamreader(@"..\..\source.tsv"); int counter = 0; while((line = reader.readline()) != null) { if(++counter % 100 == 0) { console.writeline(counter); } string response = makerequest(line.trim()).result; if(response.length == 0) ...