Which of the following code samples will check if a file is in use?
Answer
Correct Answer: protected virtual bool IsFileLocked(FileInfo file) { FileStream stream = null; try { stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None); } catch (IOException) { return true; } finally { if (stream != null) stream.Close(); } return false; }
Explanation:
Note: This Question is unanswered, help us to find answer for this one