누군가가 "."을 입력 할 때 종료되는 while 루프를 만들려고합니다.vb.net에서 무한 배열을 만드는 방법
Dim x, y As Integer
Dim stuff(x) As String
y = 1
x = 0
While y = 1
x = x + 1
Console.WriteLine("input stuff end with .")
stuff(x - 1) = Console.ReadLine()
If stuff(x - 1) = "." Then
y = 0
End If
End While
오류 메시지 : 사전에
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in practise.exe
Additional information: Index was outside the bounds of the array.
감사합니다 다음 내가 코드를 다음 오류를 얻을로
내 코드입니다.
시도를 사용 topshot (x)를'바로 당신이 ** X ** – Bugs
사용 목록 대신 배열을 증가 후. – dbasnett
다음은 배열 대신 항목 목록 수가 다를 때 [List'] (https://msdn.microsoft.com/en-us/library/6sh2ey19#Anchor_8)와 같은 제네릭 컬렉션을 사용해야하는 이유 중 하나입니다. http : //stackoverflow.com/a/34453165/1383168. – Slai