Class Feature
Represents a feature.
public record Feature : IDictionary<TagTypeKey, object?>, ICollection<KeyValuePair<TagTypeKey, object?>>, IEnumerable<KeyValuePair<TagTypeKey, object?>>, IEnumerable, IEquatable<Feature>
- Inheritance
-
Feature
- Implements
- Inherited Members
- Extension Methods
Constructors
Feature(object?)
Represents a feature.
public Feature(object? Representation = null)
Parameters
Representationobject- The representation of the feature.
Properties
Count
Gets the number of elements contained in the ICollection<T>.
public int Count { get; }
Property Value
- int
- The number of elements contained in the ICollection<T>.
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
- true if the ICollection<T> is read-only; otherwise, false.
this[TagTypeKey]
Gets or sets the element with the specified key.
public object? this[TagTypeKey key] { get; set; }
Parameters
keyTagTypeKey- The key of the element to get or set.
Property Value
- object
- The element with the specified key.
Exceptions
- ArgumentNullException
keyis null.- KeyNotFoundException
- The property is retrieved and
keyis not found. - NotSupportedException
- The property is set and the IDictionary<TKey, TValue> is read-only.
Keys
Gets an ICollection<T> containing the keys of the IDictionary<TKey, TValue>.
public ICollection<TagTypeKey> Keys { get; }
Property Value
- ICollection<TagTypeKey>
- An ICollection<T> containing the keys of the object that implements IDictionary<TKey, TValue>.
Representation
The representation of the feature.
public object? Representation { get; init; }
Property Value
Values
Gets an ICollection<T> containing the values in the IDictionary<TKey, TValue>.
public ICollection<object?> Values { get; }
Property Value
- ICollection<object>
- An ICollection<T> containing the values in the object that implements IDictionary<TKey, TValue>.
Methods
Add(TagTypeKey, object?)
Adds an element with the provided key and value to the IDictionary<TKey, TValue>.
public void Add(TagTypeKey key, object? value)
Parameters
keyTagTypeKey- The object to use as the key of the element to add.
valueobject- The object to use as the value of the element to add.
Exceptions
- ArgumentNullException
keyis null.- ArgumentException
- An element with the same key already exists in the IDictionary<TKey, TValue>.
- NotSupportedException
- The IDictionary<TKey, TValue> is read-only.
Add(KeyValuePair<TagTypeKey, object?>)
Adds an item to the ICollection<T>.
public void Add(KeyValuePair<TagTypeKey, object?> item)
Parameters
itemKeyValuePair<TagTypeKey, object>- The object to add to the ICollection<T>.
Exceptions
- NotSupportedException
- The ICollection<T> is read-only.
Clear()
Removes all items from the ICollection<T>.
public void Clear()
Exceptions
- NotSupportedException
- The ICollection<T> is read-only.
Contains(KeyValuePair<TagTypeKey, object?>)
Determines whether the ICollection<T> contains a specific value.
public bool Contains(KeyValuePair<TagTypeKey, object?> item)
Parameters
itemKeyValuePair<TagTypeKey, object>- The object to locate in the ICollection<T>.
Returns
- bool
- true if
itemis found in the ICollection<T>; otherwise, false.
ContainsKey(TagTypeKey)
Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.
public bool ContainsKey(TagTypeKey key)
Parameters
keyTagTypeKey- The key to locate in the IDictionary<TKey, TValue>.
Returns
- bool
- true if the IDictionary<TKey, TValue> contains an element with the key; otherwise, false.
Exceptions
- ArgumentNullException
keyis null.
CopyTo(KeyValuePair<TagTypeKey, object?>[], int)
public void CopyTo(KeyValuePair<TagTypeKey, object?>[] array, int arrayIndex)
Parameters
arrayKeyValuePair<TagTypeKey, object>[]- The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndexint- The zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
- The number of elements in the source ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
GetEnumerator()
Returns an enumerator that iterates through the tags.
public Dictionary<TagTypeKey, object?>.Enumerator GetEnumerator()
Returns
- Dictionary<TagTypeKey, object>.Enumerator
- An enumerator that can be used to iterate through the tags.
GetFeatureType()
Returns the value of the copula tag of the feature as a type key, if present.
public TagTypeKey? GetFeatureType()
Returns
- TagTypeKey
- The value of the copula tag of the feature as a type key, or null if the copula tag is not present.
Exceptions
- InvalidCastException
- The value of the copula tag of the feature cannot be interpreted as a type key.
Remove(TagTypeKey)
Removes the element with the specified key from the IDictionary<TKey, TValue>.
public bool Remove(TagTypeKey key)
Parameters
keyTagTypeKey- The key of the element to remove.
Returns
- bool
- true if the element is successfully removed; otherwise, false. This method also returns false if
keywas not found in the original IDictionary<TKey, TValue>.
Exceptions
- ArgumentNullException
keyis null.- NotSupportedException
- The IDictionary<TKey, TValue> is read-only.
Remove(KeyValuePair<TagTypeKey, object?>)
Removes the first occurrence of a specific object from the ICollection<T>.
public bool Remove(KeyValuePair<TagTypeKey, object?> item)
Parameters
itemKeyValuePair<TagTypeKey, object>- The object to remove from the ICollection<T>.
Returns
- bool
- true if
itemwas successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitemis not found in the original ICollection<T>.
Exceptions
- NotSupportedException
- The ICollection<T> is read-only.
TryGetValue(TagTypeKey, out object?)
Gets the value associated with the specified key.
public bool TryGetValue(TagTypeKey key, out object? value)
Parameters
keyTagTypeKey- The key whose value to get.
valueobject- When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the
valueparameter. This parameter is passed uninitialized.
Returns
- bool
- true if the object that implements IDictionary<TKey, TValue> contains an element with the specified key; otherwise, false.
Exceptions
- ArgumentNullException
keyis null.