Dictionary 如何使用int获取字典键值

Dictionary 如何使用int获取字典键值,dictionary,Dictionary,我已经在字典中输入了一些值,我正在尝试从清单中获取第一个键值,但与列表不同,我不能将清单[]与int结合使用来检索键值。有什么办法可以让这一切顺利进行吗 Dictionary<string, Object> inventory = new Dictionary<string, Object>(); int selectCount = 0; Console.WriteLine("You currently have selected: {0}", inventory[se

我已经在字典中输入了一些值,我正在尝试从清单中获取第一个键值,但与列表不同,我不能将清单[]与int结合使用来检索键值。有什么办法可以让这一切顺利进行吗

Dictionary<string, Object> inventory = new Dictionary<string, Object>();

int selectCount = 0;
Console.WriteLine("You currently have selected: {0}", inventory[selectCount]);
Dictionary inventory=newdictionary();
int-selectCount=0;
WriteLine(“您当前已选择:{0}”,清单[selectCount]);

您可以获得一组键、一组值或一组
KeyValuePair
。这些集合都不是列表,也就是说,没有一个集合具有整数索引器,因为字典没有定义的顺序