简体   繁体   English

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

[英]how to create two dimensional Array of type bool in C#

I have a matrix kind datagrid in my WPF application and I would like to create a two dimensional Array to access the row and column of the datagrid .我的 WPF 应用程序中有一个matrix类型的datagrid ,我想创建一个二维Array来访问datagrid的行和列。 how to access the datagridcells using 2-dimensional arrays of type bool, since my result will be of type Boolean.如何使用布尔类型的二维数组访问数据网格单元,因为我的结果将是布尔类型。

for each [i][j] of this 10 x 10 rows, column array, I have to query对于这 10 x 10 行列数组的每个 [i][j],我必须查询

for example例如

[0][0] = result of one query

[0][1] = result of another query

EDIT编辑

What I have tried我试过的

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 
            }
        }

You can define 2D arrays in C#:您可以在 C# 中定义二维数组:

var array2D = new int[13, 100];
array2D[7, 11] = 48;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM