CSharp examples for Language Basics:var
Give property name to var type variable returned from a function
using System;/* w w w . java 2s . co m*/ class Program { static void Main(string[] args) { var car = getCar(); Console.WriteLine($"Model: {car.Model}"); Console.WriteLine($"Price: {car.Price}"); Console.WriteLine($"Currency: {car.Currency}"); } private static (string Model, double Price, string Currency) getCar() { return ("Tesla Model S", 75000, "USD"); } }