 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Return a C# tuple from a method
Firstly, create a tuple as shown below that calls a method.
var tuple = Show();
The above statement calls the following method −
static Tuple<int, int, int, int, int> Show()
Under the method, return the tuple as shown below −
Example
using System; public class Demo {    public static void Main() {       var tuple = Show();       Console.WriteLine(tuple.Item1);       Console.WriteLine(tuple.Item2);       Console.WriteLine(tuple.Item3);       Console.WriteLine(tuple.Item4);       Console.WriteLine(tuple.Item5);    }    static Tuple<int, int, int, int, int> Show() {       return Tuple.Create(3, 5, 7, 9, 11);    } }  Output
3 5 7 9 11
Advertisements
 