ToString报错,谁能帮我看一下报错的原因?
using System;using
class app
{
public static void Main()
{
string hoststring ="000";
Console.WriteLine("please enter hostname:");
hoststring = Console.ReadLine();
IPHostEntry hostinfo = Dns.GetHostEntry(hoststring);
IPAddress[] ips = hostinfo.AddressList;
string[] alias = hostinfo.Aliases;
Console.WriteLine("Host name : " + hostinfo.HostName);
Console.WriteLine("\nAliases : ");
for (int index = 0; index < alias.Length; index++)
{
Console.WriteLine(alias[index]);
}
Console.WriteLine("\nIP Address list :");
for (int index = 0; index < ips.Length; index++)
{
Console.WriteLine(ips[index].ToString);
}
}
}
红色部份编译不能通过,但看MSDN里面说ipaddress类有tostring的方法,为什么会出错呢?