Я визначив наступне:
public ICollection<Item> Items { get; set; }
Коли я запускаю цей код:
Items = _item.Get("001");
Я отримую таке повідомлення:
Error 3
Cannot implicitly convert type
'System.Collections.Generic.IEnumerable<Storage.Models.Item>' to
'System.Collections.Generic.ICollection<Storage.Models.Item>'.
An explicit conversion exists (are you missing a cast?)
Хтось може пояснити, що я роблю не так. Мене дуже бентежить різниця між Enumerable, Collections та використанням ToList ()
Додана інформація
Пізніше у своєму коді я маю таке:
for (var index = 0; index < Items.Count(); index++)
Чи можу я визначити елементи як IEnumerable?