/// <summary> /// Gets index by name of the item. (unused) /// </summary> /// <param name="name">Search</param> /// <param name="index">Index</param> /// <returns></returns> public int GetIndexAtName(string name, int index) { int thing = 0; if (index <= 0) { return(0); } Node current = head.GetNext(); string temp; for (int i = 0; i < index; i++) { temp = current.GetName(); if (temp == name) { //Console.WriteLine("Found"); thing = i; break; } else { } current = current.GetNext(); } return(thing); }
/// <summary> /// Returns string representation of the list. /// </summary> /// <returns></returns> public override string ToString() { Node current = head.GetNext(); string output = "Inventory:\n"; while (current != null) { output += $"[{current.GetName()}]"; current = current.GetNext(); } return(output); }