2015년 9월 21일 월요일

[ C# ] file 사용여부 체크

[ C# ]  file 사용여부 체크
try
{
   using (Stream stream = new FileStream("MyFilename.txt", FileMode.Open))
   {
        // File/Stream manipulating code here
   }
} catch {
  //check here why it failed and ask user to retry if the file is in use.
}


댓글 없음:

댓글 쓰기