private void button1_Click(object sender, EventArgs e)
{
string[] array1 = { "C:/folder/a.txt", "C:/folder/b.txt", "C:/folder/c.txt", "C:/folder/d.txt" };
string[] array2 = { "D:/a.txt", "D:/b.txt", "D:/c.txt", "D:/d.txt" };
var hash1 = new HashSet<string>(array1);
var hash2 = new HashSet<string>(array2);
}
I want to compare hash1 and hash2. If a.txt file exists on the hash2 then remove C:/folder/a.txt from hash1. Can we do this without Iterate values ?
If I’m not wrong, then it should be this:
That is, it would be enough to create
HashSetwith the necessary values already. So all the calculations are done over arrays.