Main Site Documentation

Size of 2D Arrays?


#1

How to get the number of cols and rows in a matrix in NETMF?

// E.g. a 2D array of strings:

string[,] a = new string[,]
{
    {"1", "2"},
    {"3", "4"},
    {"5", "6"},
    {"7", "8"}
};

2 Cols and 4 Rows…


#2

There is no multidimensional arrays on NETMF altogether. You can use jagged arrays instead

[][] // allowed
[,] //not allowed


#3

The easiest way would be (using a jagged array) would be to use the Length property. But, with a jagged array, there may not be an equal number of rows, so you may have to create a function to verify that all the rows are the right length if that’s what you need to do to simulate a 2d array.