c# Dictionary拓展2个key得到1个value

using System.Collections.Generic;
using System.Collections;
Dictionary<Tuple<int, int>, int> dic = new Dictionary<Tuple<int, int>, int>();
dic.Add(new Tuple<int, int>(1, 2), 100);
dic.Add(new Tuple<int, int>(1, 3), 200);
dic.Add(new Tuple<int, int>(2, 1), 300);
int result = dic[new Tuple<int, int>(1, 3)];   //200

 

posted @ 2018-06-21 11:27  quanzhan  阅读(611)  评论(1编辑  收藏  举报