When we define a property as IEnumerable, we can only iterate through each items. But when we define a property as ICollection, we can add, edit, update and delete item from the property.
Interviews2 answers
What is the difference between IEnumerable and ICollection?
2 Answers
Kiran MohantyPosted Sep 7, 2020, 10:55 PM EDT
IEnumerable interface has only single method - GetEnumerator() and it must return an instance of an object of a class which implements the IEnumerator interface.
ICollection inherits IEnumerable apart from it contains some more method and IsSynchronized and SyncRoot properties help to make the collection thread-safe. ICollection supports count property too.
Uttam BobaladePosted Aug 9, 2020, 6:37 AM EDT


