var type as return type, tuple type - CSharp Language Basics

CSharp examples for Language Basics:var

Description

var type as return type, tuple type

Demo Code

using System;//w  ww .  j  a  va2  s .co  m
class Program
{
   static void Main(string[] args)
   {
      var car = getCar();
      Console.WriteLine($"Model: {car.Item1}");
      Console.WriteLine($"Price: {car.Item2}");
      Console.WriteLine($"Currency: {car.Item3}");
      Console.ReadKey();
   }
   private static (string, double, string) getCar()
   {
      return ("Tesla Model S", 75000, "USD");
   }
}

Result


Related Tutorials