开发者

Getting values from dictionary

I have a Dictionary<int, int> in my class. How can I access both values without knowing the key?

For instance, I want to be able to do something like this: If the dictionary contains Dictionary&l开发者_如何学Pythont;int, int>

and the values are <5, 4>

I want to be able to get the value of <(this),(this)> like

Pseudo code:

foreach(Dictionary item or row)
{
    my first int = Dictionary<(this), (not this)>
    my second int = Dictionary<(not this), (this)>
}

How can I do this using a dictionary? If this is not doable: Is there another way?


foreach (KeyValuePair<int, int> kvp in myDictionary)
{
   var first = kvp.Key;
   var second = kvp.Value;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜