Tuple Deconstruction Explicit Typing - CSharp Language Basics

CSharp examples for Language Basics:Tuple

Description

Tuple Deconstruction Explicit Typing

Demo Code

using System;//ww w.j a v  a  2 s.  co m
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
class TupleDeconstructionExplicitTyping
{
   static (int x, int y, string text) MethodReturningTuple() => (1, 2, "t");
   static void Main()
   {
      (int a, int b, string name) = MethodReturningTuple();
      Console.WriteLine($"a: {a}; b: {b}; name: {name}");
   }
}

Result


Related Tutorials