Description
The Move
method in the ComponentList
class is used to change the position of a specified component within the list by a given delta. The delta value determines the direction and magnitude of the move: a negative delta moves the component up in the list, while a positive delta moves it down.
Usage
To use the Move
method, you need to provide a reference to the component you wish to move and an integer delta value indicating how many positions to move the component within the list. Ensure that the component is part of the list before attempting to move it.
Example
// Example usage of the Move method
ComponentList componentList = new ComponentList();
Component myComponent = new Component();
// Add the component to the list
componentList.Create(myComponent.GetType(), true);
// Move the component up by one position
componentList.Move(myComponent, -1);
// Move the component down by two positions
componentList.Move(myComponent, 2);