0

I'm currently trying to work with interfaces of Lists, for example: IEnumerable, IList, ICollection. However, I notice that AddRange is missing in these. What am I doing wrong?

static void Main(string[] args)
{
    IEnumerable<string> IEnumerableTest = new List<string>(); // Why can't I add anything (No Add, No AddRange)?
            
    IList<string> iListTest = new List<string>();
    iListTest.Add("Test Item"); // AddRange missing?

    ICollection<string> testList2 = new Collection<string>(); // Why can't I add items?
    testList2.Add("Test Item"); // AddRange is missing, only Add available
}
Jay
  • 189
  • 4
  • 12

0 Answers0