먼저 튜플을 설정하십시오 -
Tuple<int, int> t = Tuple.Create(99,53);
이제 튜플을 배열로 변환하십시오 -
int[] arr = new int[]{t.Item1, t.Item2}; 다음은 튜플을 배열로 변환하는 코드입니다 -
예
using System;
using System.Linq;
using System.Collections.Generic;
namespace Demo {
public class Program {
public static void Main(string[] args) {
Tuple<int, int> t = Tuple.Create(99,53);
int[] arr = new int[]{t.Item1, t.Item2};
foreach (int val in arr) {
Console.WriteLine(val);
}
}
}
} 출력
99 53