Tuple问题

笑对最好 笑对最好 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
1.静态函数方式
var tt = Tuple.Create<int, int, int, int, int, int, int,Tuple<int,int>>(1,2,3,4,5,6,7, Tuple.Create(8,9));

Console.WriteLine(tt.Rest.Item1.Item1);
Console.WriteLine(tt.Rest.Item1.Item2);
2.构造函数方式
Tuple<int, int, int, int, int, int, int, Tuple<int, int, int>> test5 = new Tuple<int, int, int, int, int, int, int, Tuple<int, int, int>>(1, 2, 3, 4, 5, 6, 7, new Tuple<int, int, int>(8, 9, 10));
Console.WriteLine(test5.Rest.Item1 + test5.Rest.Item2 + test5.Rest.Item3);

两种方式创建的超过8个的Tuple,访问方式怎么不一样。
用Create静态方法是tt.Rest.Item1.Item1,tt.Rest.Item1.Item2
用构造函数是test5.Rest.Item1,test5.Rest.Item2
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
笑对最好
C# 111,128 成员 642,536 内容