public void RemoveAt(int index) { if (index < 0 || index >= this.count) { throw new IndexOutOfRangeException("Index was outside the bounds of the array"); } this.count--; for (int i = index, Len = this.count; i < Len; i++) { m_arrNavItems[i] = m_arrNavItems[i + 1]; } NavItem[] arrTempSubItem = new NavItem[count]; Array.Copy(m_arrNavItems, arrTempSubItem, count); m_arrNavItems = arrTempSubItem; if (this.owner != null) { this.owner.Invalidate(); } }
public void Insert(int index, NavItem navItem) { if (index < 0 || index >= this.count) { throw new IndexOutOfRangeException("Index was outside the bounds of the array"); } if (navItem == null) { throw new ArgumentNullException("SubItem cannot be null"); } this.EnsureSpace(1); for (int i = this.count; i > index; i--) { m_arrNavItems[i] = m_arrNavItems[i - 1]; } navItem.OwnerNav = this.owner; m_arrNavItems[index] = navItem; this.count++; if (this.owner != null) { this.owner.Invalidate(); } }
public bool Contains(NavItem subItem) { return(this.IndexOf(subItem) != -1); }
public int IndexOf(NavItem navItem) { return(Array.IndexOf <NavItem>(m_arrNavItems, navItem)); }