CopyTo() public method

public CopyTo ( Array dest, int index ) : void
dest System.Array
index int
return void
Esempio n. 1
0
        public void MenuItemCollection_CopyTo_Empty_Nop()
        {
            var menu       = new SubMenu(new MenuItem[0]);
            var collection = new Menu.MenuItemCollection(menu);
            var array      = new object[] { 1, 2, 3 };

            collection.CopyTo(array, 1);
            Assert.Equal(new object[] { 1, 2, 3 }, array);
        }
Esempio n. 2
0
        public void MenuItemCollection_CopyTo_NotEmpty_Success()
        {
            var menuItem   = new MenuItem();
            var menu       = new SubMenu(new MenuItem[0]);
            var collection = new Menu.MenuItemCollection(menu);

            collection.Add(menuItem);
            var array = new object[] { 1, 2, 3 };

            collection.CopyTo(array, 1);
            Assert.Equal(new object[] { 1, menuItem, 3 }, array);
        }