C# 元组

Tuple<int,int> t= new Tuple<int,int>(1,6);
Console.WriteLine(t.Item1);//1
Console.WriteLine(t.Item2);//6

C#7 可以使用圆括号声明一个元组:

(string s,int t) tuple = ("string",5);
Console.WriteLine(tuple.t);//5
(string s,int t) tuple = ("string",5);
Console.WriteLine($"{tuple.s},{tuple.t}");

猜你喜欢

转载自www.cnblogs.com/mlh1421/p/10875951.html