/// <summary> /// Method creates a new Todo item, assignes it to the Assignee if any. /// The new Todo item is then inserted into the items list and finally returned. /// </summary> /// <param name="assignee">Either a Person object or null if not yet assigned</param> /// <param name="description">The desription of the Todo.</param> /// <returns>Returns the object of the created Todo item</returns> public Todo AddToDoItem(Person assignee, string description) { int nextItemId = TodoSequencer.nextTodoId(); Todo newTodo = new Todo(nextItemId, description) { Assignee = assignee }; //extend array by one and insert new todo last. int arrayLength = this.Size(); Array.Resize(ref myItems, arrayLength + 1); myItems[arrayLength] = newTodo; return(newTodo); }
/// <summary> /// The method creates a new empty list of Todo items. /// </summary> public void Clear() { myItems = new Todo[0]; TodoSequencer.reset(); }