Skip to content

getAttribute with default #5

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;
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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