TagCollection

TagCollection class

Represents the collection of tags (user defined pairs of strings)

public sealed class TagCollection : ITagCollection

Properties

NameDescription
Count { get; }Returns a number of tags in the collectoin. Read-only Int32.
IsSynchronized { get; }Returns a value indicating whether access to the collection is synchronized (thread-safe). Read-only Boolean.
Item { get; set; }Returns or sets a key and a value pair of a tag.
SyncRoot { get; }Returns a synchronization root. Read-only Object.

Methods

NameDescription
Add(string, string)Adds a new tag to collection.
Clear()Removes all tags from the collection.
Contains(string)Determines whether the collection contains a specific name.
CopyTo(Array, int)Copies all elements from the collection into the specified array.
GetEnumerator()Returns an enumerator that iterates through the collection.
GetNameByIndex(int)Returns key of a tag at the specified index.
GetNamesOfTags()Returns names of tags.
GetValueByIndex(int)Returns value of a tag at the specified index.
IndexOfName(string)Returns the zero-based index of the specified key in the collection.
Remove(string)Removes the tag with a specified name from the collection.
RemoveAt(int)Removes the tag at the specified index.

Examples

The following example shows how to add a tag to a PowerPoint Presentation.

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
   ITagCollection tags = pres.CustomData.Tags;
   pres.CustomData.Tags["MyTag"] = "My Tag Value";
}

See Also