AttributeSet.Item Property
Gets or sets the value associated with the specified key.
Syntax
public AttributeValue this[Atom index] { get; set; }Parameters
The key of the element to get or set.
Property Value
The value associated with the specified key.
Remarks
Example
// Add or overwrite an existing attribute with a new double value
public static void SetDoubleAttributeValue(
    AttributeSet attributeSet, Atom key, double value)
{
    attributeSet[key] = value;
}
// Try to look up a double value in an AttributeSet
public static double GetDoubleAttributeValue(
    AttributeSet attributeSet, Atom key, double defaultValue)
{
    // Initialize the result to the default value
    double doubleValue = defaultValue;
    
    // Look up the AttributeValue with the specified name in the AttributeSet
    AttributeValue attributeValue;
    if (attributeSet.TryGetValue(key, out attributeValue))
    {
        // Try convert the AttributeValue to a double
        attributeValue.TryGetValue(out doubleValue);
    }
    
    // Return the value or default value
    return doubleValue;
}
Platforms
Windows, Linux, Android