Mega Code Archive

 
Categories / C# / Data Types
 

Tuple(T1, T2) Represents a 2-tuple, or pair

using System; public class Example {     public static void Main()     {         Tuple<string, Nullable<int>>[] scores =                      { new Tuple<string, Nullable<int>>("A", 78),                       new Tuple<string, Nullable<int>>("B", 84) };         output(scores);     }     private static void output(Tuple<string, Nullable<int>>[] scores)     {         foreach (var score in scores)         {             if (score.Item2.HasValue)             {                 Console.WriteLine(score.Item2.Value);             }         }     } }