public void Remove(WordData wordData) { int startIndexAllWordData = 0; bool assigned1 = false; int countAllWordData = 0; for (int i = 0; i < AllWordData.Count; i++) { if (AllWordData[i].WordID == wordData.WordID) { if (!assigned1) { startIndexAllWordData = i; assigned1 = true; } countAllWordData++; } } int startIndexHorizontalWordData = 0; bool assigned2 = false; int countHorizontalWordData = 0; for (int i = 0; i < HorizontalWordData.Count; i++) { if (HorizontalWordData[i].WordID == wordData.WordID) { if (!assigned2) { startIndexHorizontalWordData = i; assigned2 = true; } countHorizontalWordData++; } } int startIndexVerticalWordData = 0; bool assigned3 = false; int countVerticalWordData = 0; for (int i = 0; i < VerticalWordData.Count; i++) { if (VerticalWordData[i].WordID == wordData.WordID) { if (!assigned3) { startIndexVerticalWordData = i; assigned3 = true; } countVerticalWordData++; } } AllWordData.RemoveRange(startIndexAllWordData, countAllWordData); HorizontalWordData.RemoveRange(startIndexHorizontalWordData, countHorizontalWordData); VerticalWordData.RemoveRange(startIndexVerticalWordData, countVerticalWordData); }
private void Add(WordData wordData) { AllWordData.Add(wordData); if (wordData.IsHorizontal) { HorizontalWordData.Add(wordData); } else { VerticalWordData.Add(wordData); } }