class Program
{
static void Main(string[] args)
{
// 声明一个数组
// 类型[] 变量 = 。。。;
// int[] nums = { };
// 数组的类型是什么?
// int int[]
// 类型 type
// T[] 变量; // 泛型
// List<T>
// 词典
Dictionary<string, string> dic = new Dictionary<string, string>();
// 初始化
dic.Add("sound", "声音,合乎逻辑的");
dic.Add("late", "迟到的,过去的,已故的人或最近发生的事");
dic.Add("tell", "告诉,电话,可分辨出,可理解的");
// ...
while (true)
{
Console.WriteLine("请输入要查的单词");
string input = Console.ReadLine();
if (dic.ContainsKey(input))
{
Console.WriteLine(dic[input]);
}
else
{
Console.WriteLine("词典库未收录该单词,请联系。。。。");
}
Console.ReadKey();
}
}
}
C#泛型使用
最新推荐文章于 2024-08-03 23:17:32 发布