/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/programming-guide/language-features/arrays/jagged-length.vb
19 строк
785 B
Andy De George
Move snippets from samples repo to this repo (#17296)
03 мар 2020, 19:23
Не верифицирован
03 мар 2020, 19:23
dbbeda1
Код
Авторство
О чём код?
Module Example Public Sub Main() Dim jagged = { ({1, 2}), ({2, 3, 4}), ({5, 6}), ({7, 8, 9, 10}) } Console.WriteLine($"The value of jagged.Length: {jagged.Length}.") Dim total = jagged.Length For ctr As Integer = 0 To jagged.GetUpperBound(0) Console.WriteLine($"Element {ctr + 1} has {jagged(ctr).Length} elements.") total += jagged(ctr).Length Next Console.WriteLine($"The total number of elements in the jagged array: {total}") End Sub End Module ' The example displays the following output: ' The value of jagged.Length: 4. ' Element 1 has 2 elements. ' Element 2 has 3 elements. ' Element 3 has 2 elements. ' Element 4 has 4 elements. ' The total number of elements in the jagged array: 15