Checking if a file is in use without try catch?

前端 未结 4 1927
一向
一向 2020-12-18 23:09

Is there a way I can check if a file is in use or is not opened by other process without just trying to open it and catching an exception? Is there no service method to test

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-18 23:51

    You could implement this guy in .net 4.5 but it includes a lot of overhead http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

提交回复
热议问题