I have a array which contains a files path, I want to make a list a those file which are duplicate on the basis of their MD5. I calculate their MD5 like this:
private void calcMD5(Array files) //Array contains a path of all files
{
int i=0;
string[] md5_val = new string[files.Length];
foreach (string file_name in files)
{
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(file_name))
{
md5_val[i] = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();
i += 1;
}
}
}
}
From above I able to calculate their MD5 but how to get only list of those files which are duplicate. If there is any other way to do same please let me know, and also I am new to Linq