我想使用 int 索引访问我的字典 Dictionary 的每个对象。 如何做到这一点。
最佳答案
Dictionary<KeyType, ValueType> myDictionary = . . .
foreach(KeyValuePair<KeyType, ValueType> item in myDictionary)
{
Console.WriteLine("Key={0}: Value={1}", item.Key, item.Value);
}
关于.net - asp.net : how to access to each element of dictionary without using key?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/857162/