//单元格定义
class Cell<T> { int x; int y, T value}
////这是一个最简单逻辑结构的矩阵. 一般来说足够了
class Matrex <T>
{
List<Cell<T>> Items= new List<Cell<T>>();
////返回指定单元
Cell<T> GetCell(int x; int y)
{
Ienumarable<Cell<T>> rst = from Cell<T> crrItem
in this.Items
where crrItem.x=x && crrItem.y=y
select crrItem;
if (rst.Count()==0)
{
return null;
} // end if
else
return rst.First();
}
}//class Matrex
//如果你水平够高,且效率要求极高的话,也可以用这个结构
// Dictionary[x, Dictionary[y, cell] ] 能看懂的话相信你就会用了.
// 这相当于为所有的行列都自动做了索引,所以检索起来效率可以达到最大.
Dictionary<int, Dictionary<int, Cell<T>>> Items;
信奎爷,无所畏惧!!