If you want to add tags to a cached item, it's as simple as including an array of Tag objects to your cache call. If you want to create that array, well, that's a little more difficult. You have to create each individual Tag object and add them to the array. It'd be nice to be able to pass in an array of strings and get an array of Tags, so I've got a helper function to do just that:
/// <summary>
/// Turn a delimited string list into an array of tags
/// </summary>
/// <param name="TagList">Delimited string list</param>
/// <param name="Delimiter">Delimiter for the list</param>
/// <returns>Array of tags</returns>
private Tag[] SplitTags(string TagList, char Delimiter)
{
Array buildList = Array.CreateInstance(typeof(Tag),TagList.Split(Delimiter).GetUpperBound(0)+1);
int i = 0;
foreach (string TagValue in TagList.Split(Delimiter))
{
buildList.SetValue(new Tag(TagValue), i++);
}
return (Tag[]) buildList;
}
If anyone comes across another way to do this, please let me know.