1.Type and identifier are both required in a foreach statement
2.The name 'lines' does not exist in the current context
public void Main()
{
try
{
using (StreamReader sr = new StreamReader("g:\\computer3.txt"))
{
String line = sr.ReadToEnd().ToString();
foreach (line in lines)
{
string ipd;
IPHostEntry hostname2 = Dns.GetHostEntry(line);
IPAddress[] ip = hostname2.AddressList;
ipd = ip[0].ToString();
ResultBlock.Text = ipd;
}
}
}
catch (Exception ex)
{
ResultBlock.Text = "Could not read the file";
}
}
Support@Mytechnet.me