遍历二位数组的方法

NowMapInfo为一个in[39,13]的二维数组

NowMapInfo.GetLength(0);

取该数组第一维的长度,也就是39

NowMapInfo.GetLength(1);

取该数组第二维的长度,也就是13

 

for (int i = 0; i < NowMapInfo.GetLength(0); i++)
                    {
                        for (int j = 0; j < NowMapInfo.GetLength(1); j++)
                        {
                            if (NowMapInfo[i, j] != 0 && NowMapInfo[i, j] != 3)
                            {
                                mapDigSum++;
                            }
                        }
                    }

posted @ 2010-02-08 13:53  王翔(kingfly)  阅读(275)  评论(0编辑  收藏  举报