System.Windows.Forms.Menu.MenuItemCollection.Insert C# (CSharp) Method

Insert() private method

private Insert ( int index, MenuItem mi ) : void
index int
mi MenuItem
return void
			internal void Insert (int index, MenuItem mi)
			{
				if (index < 0 || index > Count)
					throw new ArgumentOutOfRangeException ("Index of out range");
				
				items.Insert (index, mi);
				
				UpdateItemsIndices ();
				UpdateItem (mi);
			}

Usage Example

Example #1
0
        public void MenuItemCollection_Insert_IListNotMenuItem_ThrowsArgumentException(object value)
        {
            var   menu       = new SubMenu(new MenuItem[0]);
            IList collection = new Menu.MenuItemCollection(menu);

            Assert.Throws <ArgumentException>("value", () => collection.Insert(0, value));
        }
All Usage Examples Of System.Windows.Forms.Menu.MenuItemCollection::Insert