End Google Ads 201810 - BS.net 01 --> Hi Guys. I have been pulling out the last hair on my head with this one.

I have two files, one with a list of numbers and another file containing more data. I want to take the data from file 1 and use that to search file2 for the same value and out put another value from file1 to a new file. I have now tried numerous ways of writing this and it just doesn't work. Below is a snippet of my code. The foreach statement doesn't work and if I run it without the foreach statement it only reads the first line of file 1 and doesn't continue to the next line.

while (!sr1.EndOfStream)
{
holdLineHid = sr1.ReadLine();
holdLineNot = sr.ReadToEnd();
if (String.IsNullOrEmpty(holdLineHid) || String.IsNullOrEmpty(holdLineNot))
continue;
string hid1 = holdLineHid.Substring(0, 11);
string newhid = holdLineHid.Substring(14, 11);
string hid2 = holdLineNot.Substring(0, 11);
string notremainder = holdLineNot.Substring(11, 683).Trim();
foreach (String hid in holdLineHid)
{
if (hid1 == hid2)
{
sw.WriteLine(newhid + notremainder);
}

For instance:
In File1 I have the following:

C0000000001 C0000013456
C0000000002 C0003245678

In File2 I have the following data:

C0000000003N Y Trem Chat
C0000000005Y C Just Data
C0000000001N D This Must Match


How do I get this to run properly?

Thanks in advance.

Excellence is doing ordinary things extraordinarily well.