//Example by TutorialsTeacher.com
//Learn about anonymous type at https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
using System;
public class Program
{
public static void Main()
var student = new { Id = 1, FirstName = "James", LastName = "Bond" };
Console.WriteLine(student.Id); //output: 1
Console.WriteLine(student.FirstName); //output: James
Console.WriteLine(student.LastName); //output: Bond
//the following will give compile-time error
//student.Id = 2; //error
//student.FirstName = "Steve"; //error
}