WingMan20-10 WingMan20-10 - 3 months ago 10
C# Question

IEnumerable<object> a = new IEnumerable<object>(); Can i do this?

IEnumerable<object> a = new IEnumerable<object>();


Can I do this? I just want to create a new instance of my object.
IEnumerable<object>

Answer

You can for example create an instance of List<object>, which implements IEnumerable<object>. Example:

List<object> list = new List<object>();
list.Add(1);
list.Add(4);
list.Add(5);

IEnumerable<object> en = list;
CallFunction(en);