public void Add(string s) { var newArray = new boringNode[theArray.Length + 1]; for (int i = 0; i < theArray.Length; i++) { newArray[i] = theArray[i]; } newArray[theArray.Length] = new boringNode(s); theArray = newArray; }
public void Remove(boringNode node) { var newArray = new boringNode[theArray.Length - 1]; bool flag = false; for (int i = 0; i < theArray.Length - 1; i++) { if (ReferenceEquals(node, theArray[i])) { flag = true; } newArray[i] = !flag ? theArray[i] : theArray[i + 1]; } if (!flag && !ReferenceEquals(node, theArray[theArray.Length - 1])) { return; } else { theArray = newArray; } }