Possible Duplicate:
Is there a way to check if a file is in use?
I saw there is a very easy way to check that a file is unlocked, no used by another process:
public static bool Check(string filepath)
{
try
{
using (File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.None)) {}
}
catch (Exception e)
{
log("file not ready" + e);
return false;
}
return true;
}
Well thats wonderful, but how to check if the Method would use a FileStream as parameter?
public static bool Check(FileStream f)
{
//...
Any suggestions? Thank you