C# How to iterate over HashSet?

Good afternoon, I have a HashSet which has a directory of my web server.

For example directory HashSet:
test
data
text

Is the file DATA.TXT where is the line to check:
old
new
123
ttt
eee

I need
To make a foreach for each directory HashSet nested directories from a file DATA.TXT
To make it recursive.

For example in the test directory is a sub directory and the new directory is a new directory of 123.

How to make this recursion?)
Be so kind to give me an example code.

This code recursively searches not.

foreach (string line in PatchLine)
{
try
{
 ScanReq HttpWebRequest = (HttpWebRequest)HttpWebRequest.Create("http://" + host + "/" + line);
 ScanReq.Method = "GET";
 ScanReq.UserAgent = "Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.2.15 Version/10.10";
 ScanResp HttpWebResponse = (HttpWebResponse)ScanReq.GetResponse();
 Console.Write("the Directory IS: (" + line + ") server response: "+ ScanResp.StatusCode + "\n"); // HTTP 200 OK
ScanResp.Close();

}
 catch (WebException ScanExcp) // if there is any response from the server 200 also means no directory :)
{
 Console.Write("Directory: (" + line + ") NO: "+ ((HttpWebResponse)ScanExcp.Response).StatusCode + "\n");
}
 }
July 8th 19 at 15:39

Find more questions by tags C#