public static void matrix(List<List<int>> matrix)
{
//matrix.Count is for amount of Row here
}
Example
Here the jagged array is
{{ 1, 2, 3},
{ 4, 5, 6},
{ 7, 8, 9},
{10, 11, 12}}
Then matrix.Count gives 4.
Here I want column count.
If this is array instead of List then I can use matrix.GetLength(0) and matrix.GetLength(1) to find Row count and Column count?
You are using a list of list of int. In this situation, there is no guaranty that you have a matrix with fix column size.
For example
{ {1}, {4,5,6}, {7,8}, {10,11,12,13} }is a possible combination.But, if you are sure inside lists have the same size you can get the first list's size.
Don't forget to add
using System.Linq;at top of your code.