그래서 입력 된 코드가 productcode와 일치 할 때 배열을 지우도록 단추를 코딩하려고합니다. 내가 잘못을Array.clear()를 사용하려고했지만 프로그램을 실행할 때 Index가 배열의 경계를 벗어났습니다.
string code;
code = txtcode.Text;
for (int i = 0; i < compartmentno.Length; i++)
{
if (productcode[i] == code)
{
Array.Clear(compartmentno, i, compartmentno.Length);
Array.Clear(productcode, i, productcode.Length);
Array.Clear(name, i, name.Length);
Array.Clear(weight, i, weight.Length);
Array.Clear(address, i, address.Length);
Array.Clear(status, i, status.Length);
}
어떤 생각을하고있는 중이 야 그러나이 오류 저는 여기에 사용되는 코드가 있어요 .. 내가 프로그램을 실행하려고하면 터지는 유지 (인덱스 배열의 범위를 벗어난)? 도움에 미리 감사드립니다!
당신이 배열의 전체 나머지는 삭제된다 iteration i + 1을위한 좋은 징조가 아닙니다. – Plutonix