//Hashtable用法
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
public static void Main()
{
// Creates and initializes a new Hashtable.
Hashtable myHT = new Hashtable();
myHT.Add("one", "The");
myHT.Add("two", "quick");
myHT.Add("three", "brown");
myHT.Add("four", "fox");
// Displays the Hashtable.//清清月儿 http://blog.youkuaiyun.com/21aspnet/
Console.WriteLine("The Hashtable contains the following:");
PrintKeysAndValues(myHT);
}
public static void PrintKeysAndValues(Hashtable myHT)
{
foreach (string s in myHT.Keys)
Console.WriteLine(s);
Console.WriteLine(" -KEY- -VALUE-");
foreach (DictionaryEntry de in myHT)
Console.WriteLine(" {0}: {1}", de.Key, de.Value);
Console.WriteLine();
}
}
}Hashtable用法
最新推荐文章于 2021-02-27 16:00:10 发布
1337

被折叠的 条评论
为什么被折叠?



