租用问题

质量为本、客户为根、勇于拼搏、务实创新

< 返回租用问题列表

c#元组创建的有哪些方法,c#元组对象的解构

发布时间:2024-03-18 19:03:33

c#元组创建的有哪些方法

在C#中,可使用以下方法创建元组:

  1. 使用Tuple类:
Tuple<int, string> tuple = new Tuple<int, string>(1, "hello");
  1. 使用ValueTuple结构:
ValueTuple<int, string> valueTuple = (1, "hello");
  1. 使用强类型方法创建元组:
var tuple = (count: 1, message: "hello");