private bool IsFileInUse(string strFileName)
{
if (!File.Exists(strFileName))
return false;
bool bRet = true;
FileStream fs = null;
try
{
fs = new FileStream(strFileName, FileMode.Open, FileAccess.Write, FileShare.None);
bRet = false;
}
catch
{
}
finally
{
if (fs != null)
fs.Close();
}
return bRet;
}
C#判断文件是否正在使用
猜你喜欢
转载自blog.csdn.net/weixin_43935474/article/details/106421392
今日推荐
周排行