Search Results for

    Show / Hide Table of Contents

    Class HexValueAttribute

    Inheritance
    System.Object
    HexValueAttribute
    Namespace: IronPPT.Enums
    Assembly: IronPPT.dll
    Syntax
    public class HexValueAttribute : Attribute

    HexValueAttribute is the decoration that ties an enum member to a hex string, so a named value such as a color or pattern constant carries the literal hex it stands for. It pairs a readable identifier in code with the underlying hex token a presentation file expects, keeping the mapping next to the value rather than in a separate lookup.

    You apply it to an enum member at declaration, passing the hex string to its constructor. At runtime, code that needs the literal reads the value back through reflection on the member. The attribute holds a single read-only property, HexValue, which returns the string supplied to the constructor; there is no setter, so the value is fixed once the member is declared.

    Because HexValueAttribute is a metadata annotation, you do not construct it directly in normal application flow. The framework reads it when it resolves a member to its hex token, so the everyday job is choosing the right hex string when an enum member is defined, often a six-digit color hex consumed when building a Color. The paragraph style example shows applying styling that resolves to such values on a slide.

    var attr = new HexValueAttribute("FF0000");
    string hex = attr.HexValue;

    Constructors

    HexValueAttribute(String)

    Declaration
    public HexValueAttribute(string hexValue)
    Parameters
    Type Name Description
    System.String hexValue

    Properties

    HexValue

    Declaration
    public string HexValue { get; }
    Property Value
    Type Description
    System.String
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet