using System.Collections.Generic;
public string Name { get; set; }
public Student(string name)
public static void Example1()
var students = new List<Student>();
students.Add(new Student("John"));
students.Add(new Student("Dick"));
students.Add(new Student("Harry"));
foreach (var s in students)
Console.WriteLine(s.Name);
public static void Example2()
var students = new List<Student>
foreach (var s in students)
Console.WriteLine(s.Name);
public static void Main()