Tuple Element Access - CSharp Language Basics

CSharp examples for Language Basics:Tuple

Description

Tuple Element Access

Demo Code

using System;//from   w  ww .  ja  v  a 2  s .  c  o m
class ElementAccess
{
   static void Main()
   {
      var tuple = (x: 5, 10);
      Console.WriteLine(tuple.x);
      Console.WriteLine(tuple.Item1);
      Console.WriteLine(tuple.Item2);
      tuple.x = 100;
      Console.WriteLine(tuple.Item1); // Prints 100
   }
}

Result


Related Tutorials