我正在编写代码来检查文件路径计算哈希 (SHA1) 并复制它们。 我确保我不会像使用
那样锁定它们public static string SHA1(string filePath)
{
var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
var formatted = string.Empty;
using (var sha1 = new SHA1Managed())
{
byte[] hash = sha1.ComputeHash(fs);
foreach (byte b in hash)
{
formatted += b.ToString("X2");
}
}
return formatted;
}
那么我如何才能在 Visual Studio 中找到锁定文件的位置?
最佳答案
你能保持上面的语法并试一试吗?
using(var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
//Your code goes here.
}
关于c# - 我的 C# 应用程序正在锁定一个文件,我如何才能找到它在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3708663/