示例
安装NuGet包
NuGet\Install-Package System.ValueTuple -Version 4.5.0
Program.cs
using System;
using ClassLibrary1;
namespace ValueTupleExample
{
public class Customer
{
public (int customerID, string customerName, string email) GetCustomerDetails()
{
return (101, "Scott", "scott@gmail.com");
}
}
class Program
{
static void Main()
{
//create object
Customer customer = new Customer();
//get details
(int customerID, string customerName, string email) cust = customer.GetCustomerDetails();
Console.WriteLine(cust.customerID);
Console.WriteLine(cust.customerName);
Console.WriteLine(cust.email);
Console.ReadKey();
}
}
}
标签:200,Console,string,customerName,Value,Tuples,WriteLine,customerID,cust
From: https://blog.csdn.net/KevinHuang2088/article/details/140855434