static void Main(string[] args) { collection coll = new collection(); coll.Add(new Student() { Id = 101, name = "Karthik", blood_group = "APositive", hometown = "chennai" }); coll.Add(new Student() { Id = 102, name = "jessi", blood_group = "ANegative", hometown = "Kanchipuram" }); coll.Add(new Student() { Id = 103, name = "varun", blood_group = "BPositive", hometown = "coimbatore" }); coll.Add(new Student() { Id = 104, name = "nithya", blood_group = "OPositive", hometown = "Madurai" }); coll.Add(new Student() { Id = 105, name = "sai", blood_group = "A1BNegative", hometown = "chennai" }); foreach (Student student in coll) { Console.WriteLine(student.Id + " " + student.name + " " + student.blood_group + " " + student.hometown); } }
public collectionenumerator(collection c) { co = c; }