robot_2Generated
code_blocksInput

Description

The Clone method in the Sandbox.UI.BaseStyles class is used to perform a deep copy of the current stylesheet. This method creates a new instance of the stylesheet with all the properties and values copied from the original, ensuring that changes to the cloned instance do not affect the original instance.

Usage

To use the Clone method, simply call it on an instance of BaseStyles. The method does not take any parameters and returns a new object that is a deep copy of the original stylesheet.

Example

BaseStyles originalStyles = new BaseStyles();
// Set some properties on originalStyles
originalStyles.Width = new Length(100, LengthUnit.Pixel);
originalStyles.BackgroundColor = Color.Red;

// Clone the original styles
BaseStyles clonedStyles = (BaseStyles)originalStyles.Clone();

// Modify the cloned styles
clonedStyles.Width = new Length(200, LengthUnit.Pixel);

// originalStyles.Width remains 100px, while clonedStyles.Width is 200px