C# how to add items to a iContainer?

Hi guys.

I have:

interface iContainer

{

}

Is there a way to use a method to add items to it? I can not seem to find this in my textbook. Thank you in advance.

2 Answers

Relevance
  • 3 years ago

    That's an interface definition. If you're defining it, you get to say what methods the interface supports. One of those methods could be the Add() operation that you want.

    It will be up to each class that *implements* that interface to decide how to actually perform that addition.

  • AJ
    Lv 7
    3 years ago

    Use List<type> as your collection object

    Event is a class

    List<Event> EventSchedule = new List<Event>;

    EventSchedule.add(Event);

    Then you can use LINQ to query against the collection.

Still have questions? Get your answers by asking now.