CSharp examples for Language Basics:var
Create object with var
using static System.Console; using System;/*from w ww . j a v a 2 s .c o m*/ class Program { static void Main(string[] args) { var p1 = new Person(); p1.Name = "Back"; p1.DateOfBirth = new DateTime(2020, 12, 22); WriteLine($"{p1.Name} was born on {p1.DateOfBirth:dddd, d MMMM yyyy}"); } } public class Person : object { public string Name; public DateTime DateOfBirth; }