C# Tuple Tuple
Description
Tuple Tuple
initializes
a new instance of the Tuple class.
Syntax
Tuple<T1, T2>.Tuple<T1, T2>
has the following syntax.
public Tuple(
T1 item1,
T2 item2
)
Parameters
Tuple<T1, T2>.Tuple<T1, T2>
has the following parameters.
item1
- The value of the tuple's first component.item2
- The value of the tuple's second component.
Example
/*ww w .j ava 2s.c o m*/
using System;
public class MainClass{
public static void Main(String[] argv){
var tuple2 = Tuple.Create("New York", 32.68);
Console.WriteLine("{0}: {1}", tuple2.Item1, tuple2.Item2);
tuple2 = new Tuple<string, double>("New York", 32.68);
Console.WriteLine("{0}: {1}", tuple2.Item1, tuple2.Item2);
}
}
The code above generates the following result.