C
C#7mo ago
Ewan

✅ Why is it showing me this error?

i dont get why its out of range
No description
8 Replies
Angius
Angius7mo ago
Well, processes is a multidimensional array The length of a multidimensional array is it's total length 14 in your case
Ewan
EwanOP7mo ago
oh what what do i have to do to make it work? replace the proccesses.length with 14? but i dont want 14 values i just want it to print out all the second values from each thing
Angius
Angius7mo ago
.GetLength(x) will get you the length of the xth dimension
Ewan
EwanOP7mo ago
im not sure what to do to make mine work ;-;
MODiX
MODiX7mo ago
Angius
REPL Result: Success
int[,] arr = {
{1, 2},
{3, 4},
{5, 6},
{7, 8},
};
Console.WriteLine($"0: {arr.GetLength(0)}\n1: {arr.GetLength(1)}\ntotal: {arr.Length}");
int[,] arr = {
{1, 2},
{3, 4},
{5, 6},
{7, 8},
};
Console.WriteLine($"0: {arr.GetLength(0)}\n1: {arr.GetLength(1)}\ntotal: {arr.Length}");
Console Output
0: 4
1: 2
total: 8
0: 4
1: 2
total: 8
Compile: 450.482ms | Execution: 57.090ms | React with ❌ to remove this embed.
Angius
Angius7mo ago
Here, fixed You want to iterate over the 0th dimension while keeping the 1st constant, at 1 If so, then loop until .GetLength(0) not until .Length
Ewan
EwanOP7mo ago
ohhhhhhhhhhhhhhh i SEE ok it works now, i totally understand thank you!!
Angius
Angius7mo ago
Nice Anytime
Want results from more Discord servers?
Add your server