Class MetadataCollection
Represents a collection of metadata entries, each consisting of a key and a value. This class provides methods to manage metadata efficiently, allowing addition, removal, and key-based queries.
public sealed class MetadataCollection : IList<Metadata>, ICollection<Metadata>, IEnumerable<Metadata>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged
- Inheritance
-
MetadataCollection
- Implements
- Inherited Members
Constructors
- MetadataCollection()
Initializes a new instance of the MetadataCollection class that is empty.
- MetadataCollection(MetadataCollection)
Initializes a new instance of the MetadataCollection class that contains the metadata entries copied from the specified MetadataCollection.
Properties
- Count
Gets the number of metadata entries currently in the collection.
- this[int]
Gets or sets the metadata entry at the specified zero-based index.
Methods
- Add(Metadata)
Adds a metadata entry to the collection.
- Add(MetadataCollection)
Adds all metadata entries from another MetadataCollection to this collection.
- Add(KeyValuePair<string, string>)
Adds a metadata entry to the collection using a key-value pair.
- Add(string, string)
Adds a metadata entry to the collection by specifying a key and a value.
- AddOrReplace(MetadataCollection)
Adds or replaces metadata entries from the specified collection. For each metadata in the provided collection, if an entry with the same key exists in this collection, it is replaced; otherwise, it is added.
- Clear()
Removes all metadata entries from the collection.
- Clone()
Creates a deep copy of the current MetadataCollection instance.
- Contains(Metadata)
Checks whether the metadata collection contains the specified metadata entry.
- ContainsKey(string)
Determines whether a metadata entry with the specified key exists in the collection.
- ElementAt(int)
Retrieves the metadata entry at the specified zero-based index.
- Get(string)
Retrieves the metadata entry with the specified key.
- GetEnumerator()
Returns an enumerator that iterates through the metadata entries in the collection.
- IndexOf(Metadata)
Returns the zero-based index of the first occurrence of the specified metadata entry in the collection.
- Insert(int, Metadata)
Inserts a metadata entry into the collection at the specified index.
- Remove(Metadata)
Removes the specified metadata entry from the collection.
- Remove(string)
Attempts to remove the first occurrence of a metadata entry with the specified key from the collection.
- RemoveAt(int)
Removes the metadata entry at the specified index.
- TryGet(string, out Metadata)
Attempts to retrieve the metadata entry with the specified key.
- TryGetValue(string, out string)
Attempts to retrieve the value associated with the specified key.
Events
- CollectionChanged
Occurs when the collection changes, such as when items are added, removed, or the entire list is refreshed. Clients can subscribe to this event to be notified of dynamic changes to the collection.
- PropertyChanged
Occurs when a property value changes. For example, this event is raised when the Count property changes due to addition or removal of items.