Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Select list items at the same index as another list
    text
    copied!<p>A little stuck once again. </p> <p>I have been trying to find a way to code the following (all of my attempts failed unfortunately...)</p> <p>I have two arrays/lists whatever you want to call them. Both have different items in them, although they will always have the same number of items. For the sake of my question, these lists have 3 items each.</p> <p>How would one go about coding it so that if I take item 2 from list 1, item 2 from list 2 would also be transported.</p> <p>So.. effectively.. If I was to move item 2 from list 1 to list 3, I would like item 2 from list 2 to go to list 4.</p> <p>If that makes sense...</p> <p>Do not have any code to show off as I have not found a way to code this yet.. Any kind souls that would be able to educate me in this matter?</p> <p>Thank you.</p> <p><strong>EDIT</strong></p> <p>The actual thing I am trying to do is this:</p> <p>I have a list of real-time generated hashes, a list of locations for files those hashes came from, and a list of healthy hashes. I am comparing both hash lists to find differences, then I am listing the differences. (all of which I have already coded) THe last thing i want to do is by using the listed hashes that do not match the healthy ones, return their directory (which is already in the list mentioned above)</p> <pre><code>string path = Application.ExecutablePath; // &lt;------- Get full file path from this EXE string root = Path.GetDirectoryName(path); // &lt;------- Get just the directory from above file path IEnumerable&lt;string&gt; list0 = File.ReadLines(root + "/healthy.txt"); List&lt;string&gt; list1 = new List&lt;string&gt;(); IEnumerable&lt;string&gt; list2 = Directory.EnumerateFiles(root, "*.lol", SearchOption.AllDirectories); List&lt;string&gt; list3 = new List&lt;string&gt;(); foreach (string forone in list0) { list1.Add(forone.ToString()); } foreach (string obj in list2) { listBox4.Items.Add(obj.ToString()); list3.Add(GetMD5HashFromFile(obj.ToString())); } foreach (string obj2 in list3) { listBox2.Items.Add(obj2.ToString()); } foreach (string hea in list1) { listBox1.Items.Add(hea.ToString()); } IList&lt;string&gt; difference = list3.Except(list1).ToList(); foreach (string something in difference) { listBox3.Items.Add(something.ToString()); } </code></pre> <p>Please note that listboxes are only used for troubleshooting and so I can see what is in the arrays.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload