I have a class Category that has:
public int id { get; set; }
public string catName { get; set; }
public List<string> subCat { get; set; }
I want to create a list like this:
List<Category> list = new List<Category>();
Category cat = new Category(){ 1 ,"Text", new List<string>(){"one", "two", "three"}};
list.Add(cat);
I get red error mark with this error message:
Cannot initialize type 'Category' with a collection initializer because it does not implement 'System.Collection.IEnumerable'
Any help would be much appriciated.