Description
The Tags
field in the DisplayInfo
struct is a public instance field that holds an array of strings. These strings represent tags associated with a particular type or member. Tags are typically used to categorize or label types and members for easier identification and retrieval. This field is often used in conjunction with the TagAttribute
to provide metadata about the type or member it is associated with.
Usage
To use the Tags
field, you can access it directly from an instance of the DisplayInfo
struct. You can read the tags to understand the categorization of the type or member, or modify them if you need to update the metadata.
Example usage:
DisplayInfo displayInfo = new DisplayInfo();
string[] currentTags = displayInfo.Tags;
// Add a new tag
List<string> tagsList = new List<string>(currentTags);
tagsList.Add("NewTag");
displayInfo.Tags = tagsList.ToArray();
Example
DisplayInfo displayInfo = new DisplayInfo();
string[] currentTags = displayInfo.Tags;
// Check if a specific tag exists
bool hasSpecificTag = currentTags.Contains("ExampleTag");
// Add a new tag
List<string> tagsList = new List<string>(currentTags);
tagsList.Add("NewTag");
displayInfo.Tags = tagsList.ToArray();
// Output all tags
foreach (var tag in displayInfo.Tags)
{
// Process each tag
}