using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch11CardLib
{
public class Cards : CollectionBase
{
public void Add(Card newCard)
{
List.Add(newCard);
}      
public void Remove(Card oldCard)
{
List.Remove(oldCard);
}     
 public Cards()
{}      
public Card this[int cardIndex]
{
get
{
return (Card)List[cardIndex];
}
set
{
List[cardIndex] = value;}
}public void CopyTo(Cards targetCards)
{
    for (int index = 0; index < this.Count; index++)  //this是指cards类实例吗?
   {targetCards[index] = this[index];}    //此行代码看不懂,帮忙解释下
}     
 
public bool Contains(Card card)//此行代码用意?
{
return InnerList.Contains(card);   //此行代码innerlist意思是?
}
}

解决方案 »

  1.   

    this[index];this 当前对象InnerList定义在哪?没看到
      

  2.   

    C#索引器
    [修饰符] 数据类型 this[索引类型 index]
    {
        get{//获得属性的代码}                                                 
        set{ //设置属性的代码}
    }
    通过索引器可以存取类的实例的数组成员
      

  3.   

    Contains 方法确定某元素是否在 List 中