// Use this for initialization void Start() { TheList myList = new TheList(); for (int i = 0; i < elements.Length; i++) { myList.addEnd(elements [i]); //adding elements from the array into the list } textUI.text += "The source list:\n"; textUI.text += myList.PrintList(); //printing the source list myList.Insert(insertionIndex, insertionValue); //inserting a value textUI.text += string.Format("Inserting the value {0} \ninto the spot indexed {1}:\n", insertionValue, insertionIndex); //printing the message textUI.text += myList.PrintList(); myList.Remove(removalIndex); //removing a value textUI.text += string.Format("Removing the item indexed {0}:\n", removalIndex); textUI.text += myList.PrintList(); int searchInd = myList.SearchValue(searchValue); //searching by value if (searchInd == -1) { textUI.text += string.Format("An element with value {0} \nwas not found.\n", searchValue); } else { textUI.text += string.Format("An element with value {0} \nwas found at index {1}.\n", searchValue, searchInd); } }
public void RemoveByCard(Card card) { Console.Clear(); if (TheList.Contains(card)) { if (NumOfCard[TheList.IndexOf(card)] > 1) { NumOfCard[TheList.IndexOf(card)] = NumOfCard[TheList.IndexOf(card)] - 1; Console.WriteLine("Amount In List " + Name + " Is Now " + NumOfCard[TheList.IndexOf(card)]); } else { NumOfCard.RemoveAt(TheList.IndexOf(card)); TheList.Remove(card); Console.WriteLine("Card Removed From List " + Name); } } else { Console.WriteLine("Card Not In List"); } }
public void Delete(TodoCabo existing) { TheList.Remove(existing); }