The ICollection interface describes a collection that can be modified. The Add method adds an item to the collection.
Here is an example of adding an integer to a List collection:
List numbers = new List();
numbers.Add(1);
Here is an example of adding a string to a HashSet collection:
HashSet fruits = new HashSet();
fruits.Add("apple");
The ICollection interface is part of the System.Collections namespace in the .NET Framework.
C# (CSharp) ICollection.Add - 60 examples found. These are the top rated real world C# (CSharp) examples of ICollection.Add extracted from open source projects. You can rate examples to help us improve the quality of examples.