using System.Collections; var list = new ArrayList(); list.Add("one"); list.Add("two"); list.Add("three"); foreach (var item in list) { Console.WriteLine(item); }
using System.Collections.Generic; var list = new ListIn this example, the List class implements ICollection, but this time the generic version is used with the string type. In conclusion, ICollection is a fundamental interface in C# that is used to work with collections of objects. It is part of the System.Collections namespace package library.(); list.Add("one"); list.Add("two"); list.Add("three"); foreach (var item in list) { Console.WriteLine(item); }