public void DeleteStock(int StockNumber) { if (StockNumber < 23) { int k = 0; Stock[] tmpstocks = new Stock[Stocks.Length - 1]; for (int i = 0; i < Stocks.Length; i++) { if (Stocks[i].StockNumber == StockNumber) { continue; } else { tmpstocks[k] = Stocks[i]; k++; } } Stocks = tmpstocks; } else if (StockNumber >= 23 && StockNumber <= 26) { int k = 0; Company[] tmpstocks = new Company[companies.Length - 1]; for (int i = 0; i < companies.Length; i++) { if (companies[i].StockNumber == StockNumber) { continue; } else { tmpstocks[k] = companies[i]; k++; } } companies = tmpstocks; } else { int k = 0; TVRadioComp[] tmpstocks = new TVRadioComp[tVRadioComps.Length - 1]; for (int i = 0; i < tVRadioComps.Length; i++) { if (tVRadioComps[i].StockNumber == StockNumber) { continue; } else { tmpstocks[k] = tVRadioComps[i]; k++; } } tVRadioComps = tmpstocks; } }
public void AddStock(TVRadioComp number) { Array.Resize(ref tVRadioComps, tVRadioComps.Length + 1); tVRadioComps[tVRadioComps.Length - 1] = number; }