c# - 如何检查文件列表的文件内容是否相同?
问题描述
我有一个文件列表并希望检查这些文件是否相同(内容/大小)
IEnumerable<string> results = GetFiles("DirectorPath"); //This function returns the list of file names
foreach (string entry in results)
{
FileInfo fileInfo = new FileInfo(Path.Combine("C:\beta\source"), entry));
//How I do check if the elements of **results** are identical or not ??
//Problem is that the **results** may have (2,3,4) number of files, not same every time
}
我尝试的是
foreach (string entry in results)
{
FileInfo fileInfo = new FileInfo(Path.Combine("C:\beta\source"), entry));
recentlyModFiles.Add(fileInfo); //Add the elements into another container and check for the content but will have to again use a forloop
}
有人可以用更好的方法帮助我吗?
让我知道是否需要任何其他数据
谢谢。
编辑:我的问题陈述有多个(2,3,4..)文件数量,每次都不相同,而不仅仅是2个文件。
解决方案
推荐阅读
- javascript - HTML & Javascript - 使用循环创建按钮不会“个性化” .onclick = {}
- php - 如何从另一个模型返回集合?
- c++ - 我正在尝试将我的 c++ 数组从第二个索引切到最后一个索引
- typescript - 如何从 firebase 获取动态属性的值
- android - Android recycler view位置出现index错误
- mongodb - 从 ansible 创建 mongodb 用户时出现 SCRAM-SHA-256 错误
- silverstripe - 如何使用 Silverstripe Fluent 通过 ::get() 访问区域设置字段值
- ios - 如何保存不同设备的游戏进度?
- angular - 基于复选框和表单验证无效的提交按钮禁用
- php - PHP:日期变化的增量变量