bool GetBool( Sandbox.StringToken& name, System.Boolean& defaultValue )

book_4_sparkGenerated
code_blocksInput

Description

The GetBool method in the RenderAttributes class is used to retrieve a boolean value associated with a specific attribute name. If the attribute is not found, it returns a default boolean value.

Usage

To use the GetBool method, you need to provide a StringToken that represents the name of the attribute you want to retrieve, and a reference to a boolean variable that will hold the default value if the attribute is not found.

Example usage:

RenderAttributes renderAttributes = new RenderAttributes();
StringToken attributeName = new StringToken("isVisible");
bool defaultValue = false;
bool isVisible = renderAttributes.GetBool(ref attributeName, ref defaultValue);

In this example, isVisible will be set to the value of the "isVisible" attribute if it exists, or false if it does not.

Example

RenderAttributes renderAttributes = new RenderAttributes();
StringToken attributeName = new StringToken("isVisible");
bool defaultValue = false;
bool isVisible = renderAttributes.GetBool(ref attributeName, ref defaultValue);