在C#中设置6项元组
使用C#,您可以轻松设置一个6项元组。
以下是一个6项元组-
var myTuple = new Tuple<string, string[], int, int, int, int>("electronics",
new string[] { "shoes", "clothing#", "accessories" },
100,
250,
500,
1000);上面,我们有用于字符串,字符串数组和int的元组,如下所示-
Tuple<string, string[], int, int, int, int>
这是完整的代码-
示例
using System;
class Demo {
static void Main() {
var myTuple = new Tuple<string, string[], int, int, int, int>("electronics",
new string[] { "shoes", "clothing#", "accessories" },
100,
250,
500,
1000);
//显示项目1-
Console.WriteLine(myTuple.Item1);
//显示项目5-
Console.WriteLine(myTuple.Item5);
//显示项目6-
Console.WriteLine(myTuple.Item6);
}
}输出结果
electronics 500 1000
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短