    

 ## On this page

  

 

 # Class AttributeCollection

 Last update: 16.07.2025 

Namespace: [VM.Managed](VM.Managed.md)  
Assembly: VMAppCore.dll

This class is to represent the attribute collection.

```csharp
public sealed class AttributeCollection : LinkContainer, IObservableObject, IDisposableObject, ILinkable, IObject, ILinkContainer, IOwned, IHasID, IEventProvider, ILinkContainerEvent, IVerifiable

```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← ObservableObject ← LinkableBase ← [LinkContainer](VM.Managed.LinkContainer.md) ← [AttributeCollection](VM.Managed.AttributeCollection.md)

#### Implements

IObservableObject, IDisposableObject, ILinkable, IObject, ILinkContainer, IOwned, IHasID, IEventProvider, [ILinkContainerEvent](VM.Managed.ILinkContainerEvent.md), [IVerifiable](VM.Managed.IVerifiable.md)

#### Inherited Members

[LinkContainer.SetModified()](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_SetModified), [LinkContainer.raise\_OnUpdating(object, LinkEventArgs)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_raise_OnUpdating_System_Object_VM_Managed_LinkEventArgs_), [LinkContainer.raise\_OnUpdate(object, LinkEventArgs)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_raise_OnUpdate_System_Object_VM_Managed_LinkEventArgs_), [LinkContainer.raise\_OnDestroying(object, LinkEventArgs)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_raise_OnDestroying_System_Object_VM_Managed_LinkEventArgs_), [LinkContainer.raise\_OnDestroy(object, LinkEventArgs)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_raise_OnDestroy_System_Object_VM_Managed_LinkEventArgs_), [LinkContainer.raise\_OnAdded(object, AddToDocEventArgs)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_raise_OnAdded_System_Object_VM_Managed_AddToDocEventArgs_), [LinkContainer.raise\_OnRemoved(object, RemoveFromDocEventArgs)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_raise_OnRemoved_System_Object_VM_Managed_RemoveFromDocEventArgs_), [LinkContainer.GetTargetListForUpdate()](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_GetTargetListForUpdate), [LinkContainer.SkipUpdateObjectImpl()](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_SkipUpdateObjectImpl), [LinkContainer.Initialize(Unit.ConvertFactor)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_Initialize_VM_Unit_ConvertFactor_), [LinkContainer.SetFlagWhenXMLFile(string, bool)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_SetFlagWhenXMLFile_System_String_System_Boolean_), [LinkContainer.SetContainer(IOwned, bool)](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_SetContainer_VM_Models_Pre_IOwned_System_Boolean_), [LinkContainer.Container](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_Container), [LinkContainer.Owner](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_Owner), [LinkContainer.Document](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_Document), [LinkContainer.ID](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_ID), [LinkContainer.IsChildExternable](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_IsChildExternable), [LinkContainer.IsExternable](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_IsExternable), [LinkContainer.OnRemoved](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_OnRemoved), [LinkContainer.OnAdded](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_OnAdded), [LinkContainer.OnDestroy](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_OnDestroy), [LinkContainer.OnDestroying](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_OnDestroying), [LinkContainer.OnUpdate](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_OnUpdate), [LinkContainer.OnUpdating](VM.Managed.LinkContainer.md#VM_Managed_LinkContainer_OnUpdating), ObservableObject.Dispose(), ObservableObject.RaisePropertyChanged(string), ObservableObject.RaisePropertyChanged(string, object, object), ObservableObject.IsDisposed, ObservableObject.TryDisposing, ObservableObject.Disposed, ObservableObject.Disposing, ObservableObject.PropertyChanged

#### Extension Methods

[LinkPropertyItemCache.GetLinkProperties(object, LinkPropertyType)](VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkProperties_System_Object_VM_Models_Pre_LinkPropertyType_), [LinkPropertyItemCache.GetLinkPropertiesAndValues(object, LinkPropertyType)](VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkPropertiesAndValues_System_Object_VM_Models_Pre_LinkPropertyType_), [LinkPropertyItemCache.GetLinkedObjects(object, LinkPropertyType)](VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkedObjects__1_System_Object_VM_Models_Pre_LinkPropertyType_)

## Constructors

### <a id="VM_Managed_AttributeCollection__ctor"></a> AttributeCollection()

Initializes a new instance of the  class.

```csharp
public AttributeCollection()

```

## Properties

### <a id="VM_Managed_AttributeCollection_Count"></a> Count

Gets the number of elements contained in the .

```csharp
public int Count { get; }

```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="VM_Managed_AttributeCollection_IsExternable"></a> IsExternable

Gets a value indicating whether this instance is Externable.

```csharp
public override bool IsExternable { get; }

```

#### Property Value

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="VM_Managed_AttributeCollection_Keys"></a> Keys

Gets an  containing the keys of the .

```csharp
public ICollection<string> Keys { get; }

```

#### Property Value

[ICollection](https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1)[string](https://learn.microsoft.com/dotnet/api/system.string)&amp;gt;

### <a id="VM_Managed_AttributeCollection_Values"></a> Values

Gets an  containing the values in the .

```csharp
public ICollection<attributebase> Values { get; }

```

#### Property Value

[ICollection](https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1)[AttributeBase](VM.Managed.AttributeBase.md)&amp;gt;

### <a id="VM_Managed_AttributeCollection_Item_System_String_"></a> this\[string\]

```csharp
public AttributeBase this[string key] { get; set; }

```

#### Property Value

[AttributeBase](VM.Managed.AttributeBase.md)

## Methods

### <a id="VM_Managed_AttributeCollection_Add_System_String_VM_Managed_AttributeBase_"></a> Add(string, AttributeBase)

Adds an element with the provided key and value to the .

```csharp
public void Add(string strKey, AttributeBase attr)

```

#### Parameters

`strKey` [string](https://learn.microsoft.com/dotnet/api/system.string)

The object to use as the key of the element to add.

`attr` [AttributeBase](VM.Managed.AttributeBase.md)

The object to use as the value of the element to add.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`strKey` is null.

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

An element with the same key already exists in the .

[NotSupportedException](https://learn.microsoft.com/dotnet/api/system.notsupportedexception)

The  is read-only.

### <a id="VM_Managed_AttributeCollection_Clear"></a> Clear()

Removes all items from the .

```csharp
public void Clear()

```

#### Exceptions

[NotSupportedException](https://learn.microsoft.com/dotnet/api/system.notsupportedexception)

The  is read-only.

### <a id="VM_Managed_AttributeCollection_ContainsKey_System_String_"></a> ContainsKey(string)

Determines whether the  contains an element with the specified key.

```csharp
public bool ContainsKey(string strKey)

```

#### Parameters

`strKey` [string](https://learn.microsoft.com/dotnet/api/system.string)

The key to locate in the .

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

true if the  contains an element with the key; otherwise, false.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`strKey` is null.

### <a id="VM_Managed_AttributeCollection_GetEnumerator"></a> GetEnumerator()

Returns an enumerator that iterates through the collection.

```csharp
public IEnumerator<keyvaluepair><string attributebase>&gt; GetEnumerator()

```

#### Returns

[IEnumerator](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1)[KeyValuePair](https://learn.microsoft.com/dotnet/api/system.collections.generic.keyvaluepair-2)[string](https://learn.microsoft.com/dotnet/api/system.string), [AttributeBase](VM.Managed.AttributeBase.md)&amp;gt;&amp;gt;

A  that can be used to iterate through the collection.

### <a id="VM_Managed_AttributeCollection_GetSchema"></a> GetSchema()

This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return nullNothingnullptra null reference (Nothing in Visual Basic) (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the XmlSchemaProviderAttribute to the class.

```csharp
public XmlSchema GetSchema()

```

#### Returns

[XmlSchema](https://learn.microsoft.com/dotnet/api/system.xml.schema.xmlschema)

An  that describes the XML representation of the object that is produced by the  method and consumed by the  method.

### <a id="VM_Managed_AttributeCollection_LinkRequestDestroy_System_Object_VM_Managed_LinkEventArgs_"></a> LinkRequestDestroy(object, LinkEventArgs)

Request for destroy the linked object.

```csharp
protected override sealed void LinkRequestDestroy(object obNotifier, LinkEventArgs arg)

```

#### Parameters

`obNotifier` [object](https://learn.microsoft.com/dotnet/api/system.object)

The linked object.

`arg` [LinkEventArgs](VM.Managed.LinkEventArgs.md)

The  instance containing the event data.

### <a id="VM_Managed_AttributeCollection_LinkRequestUpdate_System_Object_VM_Managed_LinkEventArgs_"></a> LinkRequestUpdate(object, LinkEventArgs)

Request for update the linked object.

```csharp
protected override sealed void LinkRequestUpdate(object obNotifier, LinkEventArgs arg)

```

#### Parameters

`obNotifier` [object](https://learn.microsoft.com/dotnet/api/system.object)

The linked object.

`arg` [LinkEventArgs](VM.Managed.LinkEventArgs.md)

The  instance containing the event data.

### <a id="VM_Managed_AttributeCollection_ReadXml_System_Xml_XmlReader_"></a> ReadXml(XmlReader)

Generates an object from its XML representation.

```csharp
public void ReadXml(XmlReader reader)

```

#### Parameters

`reader` [XmlReader](https://learn.microsoft.com/dotnet/api/system.xml.xmlreader)

The XmlReader stream from which the object is deserialized.

### <a id="VM_Managed_AttributeCollection_Remove_System_String_"></a> Remove(string)

Removes the element with the specified key from the .

```csharp
public bool Remove(string strKey)

```

#### Parameters

`strKey` [string](https://learn.microsoft.com/dotnet/api/system.string)

The key of the element to remove.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

true if the element is successfully removed; otherwise, false. This method also returns false if `strKey` was not found in the original .

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`strKey` is null.

[NotSupportedException](https://learn.microsoft.com/dotnet/api/system.notsupportedexception)

The  is read-only.

### <a id="VM_Managed_AttributeCollection_TryGetValue_System_String_VM_Managed_AttributeBase__"></a> TryGetValue(string, out AttributeBase)

Gets the value associated with the specified key.

```csharp
public bool TryGetValue(string strKey, out AttributeBase value)

```

#### Parameters

`strKey` [string](https://learn.microsoft.com/dotnet/api/system.string)

The key whose value to get.

`value` [AttributeBase](VM.Managed.AttributeBase.md)

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 `value` parameter. This parameter is passed uninitialized.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

true if the object that implements  contains an element with the specified key; otherwise, false.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`strKey` is null.

### <a id="VM_Managed_AttributeCollection_WriteXml_System_Xml_XmlWriter_"></a> WriteXml(XmlWriter)

Converts an object into its XML representation.

```csharp
public void WriteXml(XmlWriter writer)

```

#### Parameters

`writer` [XmlWriter](https://learn.microsoft.com/dotnet/api/system.xml.xmlwriter)

The XmlWriter stream to which the object is serialized.