Funkcja GetUpperBound () i GetLowerBound () dla tablicy
Czy ktoś może powiedzieć, co robią te dwie funkcje? Biorą argument całkowity, który ma być wymiarem. Ale w jaki sposób wartość tej liczby całkowitej zmienia dane wyjściowe?
Poniżej jest przykład, który prowadziłem.
int[, ,] intMyArr = {{{ 7, 1, 3, 4 }, { 2, 9, 6, 5 } }, { { 7, 1, 3, 4 }, { 2, 9, 6, 5 }}};
Console.WriteLine(intMyArr.GetUpperBound(0)); // Output is 1
Console.WriteLine(intMyArr.GetUpperBound(1)); // Output is 1
Console.WriteLine(intMyArr.GetUpperBound(2)); // Output is 3
Console.WriteLine(intMyArr.GetLowerBound(0)); // Output is 0
Console.WriteLine(intMyArr.GetLowerBound(1)); // Output is 0
Console.WriteLine(intMyArr.GetLowerBound(2)); // Output is 0
Każdy pomysł, dlaczego GetLowerBound () zawsze powraca 0? Jeśli to zawsze zwraca 0, to dlaczego musimy wywołać tę metodę?