tagged [multidimensional-array]

How to print the array?

How to print the array? I am not able to get the array to print.. Any ideas why? I am a beginning programmer so any words of advice are appreciated.

Unexpected value of System.Type.FullName

Unexpected value of System.Type.FullName I recently needed to build C# specific name (which must always include global:: specifier) for an arbitrary type and have come accross following issue: ``` // ...

How to use LINQ on a multidimensional array to 'unwind' the array?

How to use LINQ on a multidimensional array to 'unwind' the array? Consider the following array: `int[,] numbers = new int[3, 2] { { 2, 1 }, { 3, 4 }, { 6, 5 } };` I would like to use LINQ to construc...

Initialize 2D array

Initialize 2D array I am trying to initialize a 2D array, in which the type of each element is . So far, I can only initialize this array in the follow way. ``` public class ticTacToe { private char[...

12 Dec at 04:38

Why does typeof(Object[,][]).Name equal "Object[][,]"?

Why does typeof(Object[,][]).Name equal "Object[][,]"? Evaluating `typeof(Object[,][]).Name` gives `Object[][,]` Similarly, `typeof(Object[][,]).Name` gives `Object[,][]` Seems like the comma is movin...

How to convert a 1d array to 2d array?

How to convert a 1d array to 2d array? Say, I have a 1d array with 30 elements: How to convert the 1d array to 2d array? Say 10x3? Should I use a for loop? But I cannot work it out.

15 Feb at 15:58

How to initialize multi-dimensional array with different default value

How to initialize multi-dimensional array with different default value I am trying to initialize 2-dimensional array of integer values with -1. When I create a new array, it is automatically filled wi...

Which comes first in a 2D array, rows or columns?

Which comes first in a 2D array, rows or columns? When creating a 2D array, how does one remember whether rows or columns are specified first?

21 Mar at 18:44

Printing 2D array in matrix format

Printing 2D array in matrix format I have a 2D array as follows: I want to print the values of this array in matrix format like: How can I do this?

28 Mar at 09:58

Copy one 2D array to another 2D array

Copy one 2D array to another 2D array I used this code to copy one 2D array to another 2D array: However, when I change some data in `tempPerformance` then these changes also apply to `teamPerformance...

31 Mar at 04:20

slow performance of multidimensional array initialiser

slow performance of multidimensional array initialiser I have some weird performance results that I cannot quite explain. It seems that this line is 4 times slower than this one ``` d = new double[4, ...

How to search in 2D array by LINQ ?[version2]

How to search in 2D array by LINQ ?[version2] I have an array like this: i search in column by statement and return in column like this: ``` string className = "A"; string color = "Black"; for (int i ...

in_array() and multidimensional array

in_array() and multidimensional array I use `in_array()` to check whether a value exists in an array like below, but what about an multidimensional array (below) - how can I check that value whether i...

9 Sep at 12:26

How to initialize an array of 2D-arrays?

How to initialize an array of 2D-arrays? I have an array of 2D-arrays. For example, it is like: But If I write ``` int [,][] arrays={{{0, 0, 1}, {1, 0, 0}} {{0, 0, 3}, {2, 1, 2}, {2, 2, 1}, {...

Fastest way to zero out a 2D array in C#

Fastest way to zero out a 2D array in C# I have a 2D array that I want to clear and reset to 0 values. I know how to clear a vector (1D array) using `Array.Clear()` but I don't know the best way to cl...

How do I Sort a Multidimensional Array in PHP

How do I Sort a Multidimensional Array in PHP I have CSV data loaded into a multidimensional array. In this way each "row" is a record and each "column" contains the same type of data. I am using the ...

30 Oct at 09:39

Serializing Multidimensional array to JSON with ServiceStack

Serializing Multidimensional array to JSON with ServiceStack Returning the following object excludes the property "coordinates" from the JSON. What am I doing wrong? ``` [Route("/GeozonePolygon/{ZoneT...

Multidimensional Arrays vs. Array of Arrays in Response DTO

Multidimensional Arrays vs. Array of Arrays in Response DTO I have a DTO that I'm using with the ServiceStack 'JsonServiceClient', and it appears a multidimensional array arrives as 'null' on my clien...

How do I parse a multidimensional JSON array using ServiceStack.Text?

How do I parse a multidimensional JSON array using ServiceStack.Text? I read [this post](https://github.com/ServiceStack/ServiceStack.Text/blob/master/tests/ServiceStack.Text.Tests/UseCases/GMapDirect...

Json MultiArray & ServiceStack

Json MultiArray & ServiceStack There is a line {"level": [{"level": 1, "points": 0, "name": "Some"}, {"level": 2, "points": 50, "name": "Second level "}, {" level ": 3," points ": 100," name ":" third...

PHP: Get key from array?

PHP: Get key from array? I am sure that this is super easy and built-in function in PHP, but I have yet not seen it. Here's what I am doing for the moment: Could I do something like the following inst...

2D arrays in Python

2D arrays in Python What's the best way to create 2D arrays in Python? What I want is want is to store values like this: so that I access data like `X[2],Y[2],Z[2]` or `X[n],Y[n],Z[n]` where `n` is va...

Matrix multiplication using arrays

Matrix multiplication using arrays I'm trying to make a simple matrix multiplication method using multidimensional arrays (`[2][2]`). I'm kinda new at this, and I just can't find what it is I'm doing ...

How to insert a new key value pair in array in php?

How to insert a new key value pair in array in php? I've an array as follows named `$test_package_data`. For the reference I'm printing first two elements of it: ``` Array ( [0] => Array ( ...

Converting 2 dimensional array to Single dimensional in C#?

Converting 2 dimensional array to Single dimensional in C#? I am converting 2dimensional array to Single dimensional in C#. I receive the 2 dimensional array from device (C++) and then I convert it to...