AFNamedCollection(T).Item Property (String)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public T this[ string name ] { get; }
Public ReadOnly Default Property Item ( name As String ) As T Get Dim instance As AFNamedCollection Dim name As String Dim value As T value = instance(name)
public: virtual property T default[String^ name] { T get (String^ name) sealed; }
abstract Item : 'T with get override Item : 'T with get
Parameters
- name
- Type: SystemString
Specifies the collection member by name. It must be equal to the Name property of a member of the collection.
Property Value
Type: TThe item with the specified name. If the specified name is not found, attempting to get it returns the default value for the item type T.
Implements
IAFNamedCollectionTItemString
Exceptions
| Exception | Condition |
|---|---|
| IndexOutOfRangeException | Thrown when the specified index is out of range. |
Remarks
The Item property is intended to be used to retrieve a specific object in the collection by the specified name. If you want to enumerate the collection, you can use the GetEnumerator property in the standard way. With Microsoft® Visual Basic® and C#, this property is automatically used within For Each In constructs. This property provides the ability to access a specified item in the collection by using the following syntax: myCollection[name].
If the name is not found, then this property returns the appropriate default value for the item type T; for example, zero (0) for integer types, for Boolean types, and for reference types.
Retrieving the value of this property is an O(1) operation.
| Only the AFElements and AFAttributes collections support looking up items in the collection by name and path. All other collections only support looking up items by name. |