When a collection implements IEnumerable<T>, It’s giving you a way to write a loop that goes through its contents in order. E.g. When you write a foreach loop, you’re using IEnumerable, as below,
foreach (Duck duck in ducks) {
Console.WriteLine(duck);
}
public Deck(IEnumerable<Card> initialCards) {
cards = new List<Card>(initialCards);
}
Comments
Post a Comment