2009-08-14 2 views

답변

6

이런 식으로 뭔가 작업을해야합니다 :

public bool FileIsLocked(string fileName) 
    { 
     FileStream fs; 
     try 
     { 
      fs = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.Read, FileShare.None); 
      fs.Dispose(); 
     } 
     catch (IOException) 
     { 
      return true; 
     } 
     return false; 
    } 
0

다른 앱이 액세스하지 못하도록 열려고 시도 할 수 있습니다.

예외가 발생하면이 파일이 다른 사용자에게 사용됨을 알 수 있습니다.

관련 문제