public static bool HasAttribute(this AttributeList attributes, Identifier typeName) { if (attributes == null) return false; for (int i = 0; i < attributes.Count; i++) { var attr = attributes[i]; if (attr == null) continue; if (attr.Type == null) continue; if (typeName.Matches(attr.Type.Name)) return true; } return false; }
public static AttributeNode GetAttribute(this AttributeList attributes, Identifier attributeName) { if (attributes == null) return null; for (int i = 0; i < attributes.Count; i++) { var attr = attributes[i]; if (attr == null) continue; if (attr.Type == null) continue; if (attributeName.Matches(attr.Type.Name)) return attr; } return null; }