I have some rows of code:
public IEnumerable GetCardNames()
{
string[]cardname = new string[cards.Count];
for (int i = 0; i < cards.Count; i++)
cardname[i]= cards[i].value + " of " + cards[i].suit + "\n";
return cardname;
}
What I confused about is why it's a better way to use:
public IEnumerable GetCardNames()
than :
public string[] GetCardNames()
or :
public List GetCardNames()
I have read a lot of answers about IEnumerable but I'm still not feel so clear about this one, I mean the benefit of using IEnumerable in this case.
No comments:
Post a Comment