C# Tuple Tuple
Description
Tuple
initializes a new instance
of the Tuple class.
Syntax
Tuple<T1>.Tuple<T1>
has the following syntax.
public Tuple(
T1 item1
)
Parameters
Tuple<T1>.Tuple<T1>
has the following parameters.
item1
- The value of the tuple's only component.
Example
The following example uses the Create method to instantiate a 1-tuple whose component is of type Int32.
// ww w .ja v a 2 s .com
using System;
public class MainClass{
public static void Main(String[] argv){
var tuple1 = Tuple.Create(12);
Console.WriteLine(tuple1.Item1);
tuple1 = new Tuple<int>(12);
Console.WriteLine(tuple1.Item1);
}
}
The code above generates the following result.