C# Tuple Item1
Description
Tuple
gets the value of the Tuple
Syntax
Tuple<T1>.Item1
has the following syntax.
public T1 Item1 { get; }
Example
The following example displays information about two singletons and their components.
/* w w w .ja v a 2s . c om*/
using System;
public class Example
{
public static void Main()
{
var tuple1 = Tuple.Create(-1.23445e-32);
Type tuple1Type = tuple1.GetType();
Console.WriteLine(tuple1Type.Name);
Console.WriteLine(tuple1Type.GetGenericArguments()[0]);
Console.WriteLine(tuple1.Item1);
Console.WriteLine(tuple1.Item1.GetType().Name);
var tuple2 = Tuple.Create(1.837);
Type tuple2Type = tuple2.GetType();
Console.WriteLine(tuple2Type.Name);
Console.WriteLine(tuple2Type.GetGenericArguments()[0]);
Console.WriteLine(tuple2.Item1);
Console.WriteLine(tuple2.Item1.GetType().Name);
}
}
The code above generates the following result.