0

I have a question, not sure if it makes sense, but I couldn't find any answers related to it. While creating an entity class I was thinking is it possible to create a class which in itself could be used as a list. The way I do it currently is, I m not sure if its obsolete

MyEntityClass entityObj = new MyEntityClass();
List<MyEntityClass> entityList = new List<MyEntityClass>();
entityList.Add(entityObj);

is there an advanced to way to accomplish the same in C#?

NewTech
  • 316
  • 5
  • 23

1 Answers1

0

Implement iEnumerable interface on your base class, this will force you to implement de definition for that interface, that will make the base clase behave as you wish.

thepanch
  • 353
  • 2
  • 13