I have a file that is read (parsed into memory) with StreamReader. Originally the file is parsed and closed but the LastAccessTime is changed.
I'm using this code to set the dates as were before opening but it's not working because I still have a difference of couple of seconds between the original datetime and the one after read.
FileInfo original_File_info = new FileInfo(Constants.FilePath); /* parsing */ /* Streamreader closing*/ File.SetAccessControl(Constants.FilePath, original_File_info.GetAccessControl()); File.SetAttributes(Constants.FilePath, original_File_info.Attributes); File.SetCreationTimeUtc(Constants.FilePath, original_File_info.CreationTimeUtc); File.SetLastAccessTimeUtc(Constants.FilePath, original_File_info.LastAccessTimeUtc); File.SetLastWriteTimeUtc(Constants.FilePath, original_File_info.LastWriteTimeUtc);
How can be solved this problem?