To create a tuple, use the Tuple.Create method.
Here we have set a tuple with a string and int −
var myTuple = Tuple.Create("marks", 100);The following is an example that creates a tuple using Tuple.Create and displays the elements in a single line in C# −
Example
using System;
class Demo {
static void Main() {
var myTuple = Tuple.Create("marks", 100);
Console.WriteLine(myTuple);
}
}Output
(marks, 100)