Sparrow.Display.DisplayObjectContainer.SetChildIndex C# (CSharp) Method

SetChildIndex() public method

Moves a child to a certain index. Children at and after the replaced position move up. throws ArgumentException if the child is not found
public SetChildIndex ( DisplayObject child, int index ) : void
child DisplayObject
index int
return void
        public void SetChildIndex(DisplayObject child, int index)
        {
            int oldIndex = _children.IndexOf(child); 
            if (oldIndex == -1)
            {
                throw new ArgumentException("child not found");
            }
            _children.RemoveAt(oldIndex);
            _children.Insert(index, child);
        }