组元功能:传递多个值。

1.可以取代out

//使用out
public void Test(out int a,out string b)
{
  a=1;
  b="hello world"        
}
//使用Tuple
public Tuple<int,string> Test()
{
  return new Tuple<int,string>(1,"hello world");    
}

2.可以替代小对象class

缺点:没有无参构造函数。

 

相关文章: