- 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
Set tuple as a method parameter in C#
Firstly, set a tuple
var tuple = Tuple.Create(100, 200, 300);
Now, pass the tuple as a method parameter −
Show(tuple);
Here’s our method.
static void Show(Tuple<int,int,int> tuple)
Now call the tuple values one by one as shown below −
Example
using System; public class Program { public static void Main() { var tuple = Tuple.Create(100, 200, 300); Show(tuple); } static void Show(Tuple<int,int,int> tuple) { Console.WriteLine(tuple.Item1); Console.WriteLine(tuple.Item2); Console.WriteLine(tuple.Item3); } }
Output
100 200 300
- Related Articles
- How to pass a jQuery event as a parameter in a method?
- How to pass a lambda expression as a method parameter in Java?
- Set 6-item tuple in C#’
- How to pass a 2D array as a parameter in C?
- Return a C# tuple from a method
- What is the syntax for passing Scanner object as a parameter in a method using java?
- Passing empty parameter to a method in JavaScript
- Can a Java array be declared as a static field, local variable or a method parameter?
- Set a Pair value in Java Tuple
- How to pass a function as a parameter in Java
- Python program to convert Set into Tuple and Tuple into Set
- Class declaration with a method that has a parameter in Java
- How to set default parameter values to a function in Python?
- Does Java support default parameter values for a method?
- How to set a default parameter value for a JavaScript function?

Advertisements