public class IPAddresses : DictionaryBase
{
public IPAddresses()
: base()
{ }//调用父类默认构造方法
public void Add(string name, string ip)
{
base.InnerHashtable.Add(name, ip);
}
public string Item(string name)
{
return base.InnerHashtable[name].ToString();
}
public void Remove(string name)
{
base.InnerHashtable.Remove(name);
}
static void Main(string[] args)
{
IPAddresses ip = new IPAddresses();
ip.Add("小王", "192.168.0.1");
ip.Add("小张", "192.168.0.2");
ip.Add("小李", "192.168.0.3");
求怎么遍历这些元素
} |