Skip to content

getAttribute with default #5

@p0nce

Description

@p0nce

It would be cool if getAttribute can return a default value if the attribute is not found.

    string getAttribute(string name, string defaultValue = null) 
    {
        if (name in _attributes)
            return xmlDecode(_attributes[name]);
        else
            return defaultValue;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions