namespace Ch11CardLib
{
class Cards:CollectionBase
{
public void Add(Card newCard)
{
List.Add(newCard);
}
public void Remove(Card newCard)
{
List.Remove(newCard);
}
public Card this[int cardIndex]
{
get
{
return (Card)List[cardIndex];
}
set
{
List[cardIndex] = value;
}
}
///
///Utility method for copying card instances into another Cards
///instance-used in Deck.shuffle(). This implementation assumes that
///source and target collections are the same size.
///
public void CopyTo(Cards targetCards)
{
for (int index = 0; index < this.Count; index++)
{
targetCards[index] = this[index];
}
}
///
///Check to see if the Cards collection contains a particular card.
///This calls the Contains() method of the ArrayList for the collection,
///which you access through the InnerList Property.
///
public bool Contains(Card card)
{
return InnerList.Contains(card);
}
}
}
这里实现add和remove方法为什么前面要加LIST.。这两个方法都不是静态方法啊????