Initializing IEnumerable<string> In C#
Ok, adding to the answers stated you might be also looking for
IEnumerable<string> m_oEnum = Enumerable.Empty<string>();
or
IEnumerable<string> m_oEnum = new string[]{};
IEnumerable<T>
is an interface. You need to initiate with a concrete type (that implements IEnumerable<T>
). Example:
IEnumerable<string> m_oEnum = new List<string>() { "1", "2", "3"};
As string[]
implements IEnumerable
IEnumerable<string> m_oEnum = new string[] {"1","2","3"}