- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to convert a tuple into an array in C#?
Firstly, set a tuple −
Tuple<int, int> t = Tuple.Create(99,53);
Now, convert the tuple to an array −
int[] arr = new int[]{t.Item1, t.Item2};
The following is the code to convert a tuple into an array −
Example
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); } } } }
Output
99 53
Advertisements