static StringToken Literal( string value, System.UInt32 token )

book_4_sparkGenerated
code_blocksInput

Description

The Literal method in the StringToken struct is a static method used to create a StringToken from a given string and a token value. This method is part of the Sandbox engine's optimization strategy, where strings are converted to tokens to save space and improve performance, especially in operations like comparisons.

Usage

To use the Literal method, provide a string and a corresponding token value. The method will return a StringToken instance that encapsulates these values.

Parameters:

  • value (System.String): The string to be converted into a token.
  • token (System.UInt32): The token value associated with the string.

Returns: A StringToken instance representing the provided string and token.

Example

// Example of using the StringToken.Literal method
string myString = "example";
uint myToken = 12345;
StringToken tokenizedString = StringToken.Literal(myString, myToken);

// Now you can use tokenizedString in your application
// For example, you might store it or use it for fast comparisons