标题:ToString报错,谁能帮我看一下报错的原因?
取消只看楼主
athenalux
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:河北石家庄
等 级:小飞侠
威 望:8
帖 子:975
专家分:2514
注 册:2008-11-26
结帖率:100%
 问题点数:0 回复次数:0 
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的方法,为什么会出错呢?
搜索更多相关主题的帖子: ToString 
2008-12-04 09:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-247657-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.975154 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved