public void SetCategory(string category)
{
// If this thing already has a
// category attribute then let's
// replace it. Otherwise add a new
// instance
bool found = false;
for(int i = 0; i < Attributes.Count; i++)
{
Attribute attribute = Attributes[i];
if (attribute is CategoryAttribute)
{
CategoryAttribute categoryAttribute = new CategoryAttribute(category);
Attributes[i] = categoryAttribute;
found = true;
break;
}
}
if (!found)
{
CategoryAttribute categoryAttribute = new CategoryAttribute(category);
Attributes.Add(categoryAttribute);
}
}