Inferred Tuple Element Names - CSharp Language Basics

CSharp examples for Language Basics:Tuple

Description

Inferred Tuple Element Names

Demo Code

using System;//from   w  w  w. j av  a 2 s.c o  m
using System.Collections.Generic;
using System.Linq;
class InferredTupleElementNames
{
   static void Main()
   {
      List<int> list = new List<int> { 5, 1, -6, 2 };
      var tuple = (list.Count, Min: list.Min(), Max: list.Max());
      Console.WriteLine(tuple.Count);
      Console.WriteLine(tuple.Min);
      Console.WriteLine(tuple.Max);
   }
}

Related Tutorials