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 reference for the attribute name and a reference to a boolean variable for the default value. The method will return the boolean value associated with the given name if it exists; otherwise, it will return the provided default value.

Example

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

// isVisible will be true if the attribute "isVisible" exists and is true,
// otherwise it will be false.