Adding item to List<>

.net, c#

Solution

Use the `object initializer` for a list. You can't call `Add` like that because it returns `void`, not the `List` itself. Try this:

List<Item> Items = new List<Item>
                   {
                       new Item { Code = "12223", ExGroup = 2 }
                   };

Problem

Cleary I'm missing something here but I cannot see ``` List<Item> Items = new List<Item>().Add(new Item() { Code = "12223", ExGroup = 2}); ``` Error message is Cannot implicitly convert type `void` to `List<>` Thanks

Original source