当前位置: 移动技术网 > IT编程>开发语言>.net > 判断两个文件是否相同

判断两个文件是否相同

2019年01月29日  | 移动技术网IT编程  | 我要评论

翡翠原始恐角龙,英语听力怎么提高,睡尽天下美男

using (hashalgorithm hash = hashalgorithm.create())
{
using (filestream file1 = new filestream(filepath1, filemode.open), file2 = new filestream(filepath2, filemode.open))
{
byte[] hashbyte1 = hash.computehash(file1);//哈希算法根据文本得到哈希码的字节数组
byte[] hashbyte2 = hash.computehash(file2);
string str1 = bitconverter.tostring(hashbyte1);//将字节数组装换为字符串
string str2 = bitconverter.tostring(hashbyte2);
if (str1 == str2)
{

//write

}
else
{

//write

}
}
}

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网