bool GetComboBool( Sandbox.StringToken& k, System.Boolean& defaultValue )

book_4_sparkGenerated
code_blocksInput

Description

The GetComboBool method in the RenderAttributes class is used to retrieve a boolean value associated with a specific key. This method is useful when you need to access boolean attributes that are stored in a render attribute collection, typically used in rendering contexts.

Usage

To use the GetComboBool method, you need to provide a StringToken reference that represents the key of the attribute you want to retrieve, and a reference to a boolean variable that will hold the default value if the key is not found. The method returns a boolean indicating whether the key was found and the value was successfully retrieved.

Example usage:

RenderAttributes renderAttributes = new RenderAttributes();
StringToken key = new StringToken("exampleKey");
bool defaultValue = false;
bool result = renderAttributes.GetComboBool(ref key, ref defaultValue);

In this example, result will be true if the key "exampleKey" exists in the renderAttributes and the associated value is retrieved. If the key does not exist, defaultValue will be used.

Example

RenderAttributes renderAttributes = new RenderAttributes();
StringToken key = new StringToken("exampleKey");
bool defaultValue = false;
bool result = renderAttributes.GetComboBool(ref key, ref defaultValue);

if (result)
{
    // The key was found and the value is retrieved
    // Use the retrieved value
}
else
{
    // The key was not found, use the default value
}