Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在计划的过程中生成文件并执行写操作。我需要找出生成文件所花费的时间(在执行写操作之后)。我对这个操作有点困惑。任何人都可以帮助解决这个问题。
提前致谢。
你可以得到CreationTimeandLastWriteTime并找到它们的不同之处。
CreationTime
LastWriteTime
FileInfo file = new FileInfo("C:\test.text"); Console.WriteLine(file.LastWriteTime); Console.WriteLine(file.CreationTime); var timeTaken = file.LastWriteTime - file.CreationTime;