[英]Create Tuple with more than 2 arguments
我想转换
List<Tuple<IntPtr, string, string>>
进入
Dictionary<IntPtr, Tuple<string,string>>
使用
ToDictionary
即
var T = new List<Tuple<IntPtr, string, string>>();
T.ToDictionary(/*I cannot figure out the right syntax*/);
我可以找到的所有示例只有2个参数,而我只有3个。
您应该使用Enumerable.ToDictionary重载,该重载同时接受键和值选择器:
T.ToDictionary(t => t.Item1, t => Tuple.Create(t.Item2, t.Item3))
但是请记住,列表中不应有重复的指针。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.