C# 如何在C中创建bool类型的二维数组#

C# 如何在C中创建bool类型的二维数组#,c#,wpf,wpf-controls,wpfdatagrid,C#,Wpf,Wpf Controls,Wpfdatagrid,我的WPF应用程序中有一个矩阵种类数据网格,并且 我想创建一个二维数组,以访问数据网格的行和列。如何使用bool类型的二维数组访问datagridcells,因为我的结果将是Boolean类型 对于这个10 x 10行、列数组中的每个[i][j],我必须查询 比如说 [0][0] = result of one query [0][1] = result of another query 编辑 我试过的 bool[,] cell = new bool[10, 10]; fo

我的WPF应用程序中有一个
矩阵
种类
数据网格
,并且 我想创建一个二维
数组
,以访问
数据网格的行和列
。如何使用bool类型的二维数组访问datagridcells,因为我的结果将是Boolean类型

对于这个10 x 10行、列数组中的每个[i][j],我必须查询

比如说

[0][0] = result of one query

[0][1] = result of another query
编辑

我试过的

bool[,] cell = new bool[10, 10];

        for (int i = 0; i < 10; i++)
        {
            for(int j= 0; j<10 ;j++)
            {
            cell[i,j] = (); // what to write here 
            }
        }
bool[,]单元=新bool[10,10];
对于(int i=0;i<10;i++)
{
对于(int j=0;j

您可以在C#中定义二维数组:


数组是bool类型的。你的标题类型是
bool
?是的。我现在将编辑这个问题,我没有变得更清楚。为了解决这个问题:添加细节,不要删除它们。在这里写什么:
cell[i,j]=true;
cell[i,j]=false;
或者
cell[i,j]=MyBooleanFunction(i,j)
。我们真的不能对这个问题做更多的解释。
bool[,] array = new bool[1, 3];
var array2D = new int[13, 100];
array2D[7, 11] = 48;