I'm trying to understand how to work with matrix in C#.
I used to code in Java:
int[][]arr=new int[2][5];
orint [][]arr={{2,3,4,5},{9,3}};
When I try to create an array in C# I only success to make this way:
int[,]={{1,2,3,4},{5,6,7,8}};
This line works for me but it requires same length in every column. I also try to use GetLength()
when I worked with for loops and I could get only the number of columns and the size of the second column.
- Is there any way to create a matrix with any size I want like the java examples?
- How can I get the size of the rows/columns?