C#C
C#3y ago
_._xena_._

❔ Difference between these variants

I'm learning c# right now and I saw something as
ArrayList myList = new ArrayList();
IList myList = new ArrayList();
ICollection myList = new ArrayList();

so in this case defining myList as in the first one -which is "ArrayList myList = new ArrayList();"- it has more methods in it. But we can do the others as well. My question is if you're able to have more methods and do much more things, why use IList myList = new ArrayList(); or ICollection myList = new ArrayList(); instead ? What is the difference ?
Was this page helpful?