System.Net;名字空间不能用的问题
我在写一个 索引 获取IP地址
程序如下:
using System;
using System.Net; //编译时提示没有这个名字空间,(不明白为什么是我写错了吗)
class ResolveDNS
{
IPAddress[] m_arrIPs;
public void Resolve(string strHost)
{
IPHostEntry iphe = DNS.GetHostByName(strHost);
m_arrIPs = iphe.AddressList;
}
public IPAddress this[int nIndex]
{
get
{
return m_arrIPs[nIndex];
}
}
public int Count
{
get
{
return m_arrIPs.Length;
}
}
}
class DNSResoverAppp
{
public static void Main()
{
ResolveDNS myDNSResolver = new ResolveDNS();
myDNSResolver.Resolve("http://www.microsoft.com");
int nCount = myDNSResolver.Count;
Console.WriteLine("Found{0}IP's for houstname", nCount);
for (int i; i < nCount; i++)
Console.WriteLine(myDNSResolver[i]);
}
}
//现在这个程序 不能运行 提示没有 System.Net; 名字空间 可是这个空间是对的阿,现在有点晕,希望高手 指点~!!谢谢了