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
that encapsulates these values.
Example
// Example of using the StringToken.Literal method
string myString = "example";
uint myToken = 12345;
// Create a StringToken using the Literal method
StringToken token = StringToken.Literal(myString, myToken);
// Access the token value
uint tokenValue = token.Value;
// Use the token in your application logic
// For example, comparing tokens or storing them in a collection