AFBaseElement.GetAttributeByTrait Method
- Last UpdatedJan 12, 2026
- 2 minute read
- PI System
- AF SDK 3.2.0
- Developer
Retrieves the child AFAttribute with the specified AFAttributeTrait.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
Syntax
public AFAttribute GetAttributeByTrait( AFAttributeTrait trait )
Public Function GetAttributeByTrait ( trait As AFAttributeTrait ) As AFAttribute Dim instance As AFBaseElement Dim trait As AFAttributeTrait Dim returnValue As AFAttribute returnValue = instance.GetAttributeByTrait(trait)
public: AFAttribute^ GetAttributeByTrait( AFAttributeTrait^ trait )
member GetAttributeByTrait : trait : AFAttributeTrait -> AFAttribute
Parameters
- trait
- Type: OSIsoft.AF.AssetAFAttributeTrait
The AFAttributeTrait to search for the desired AFAttribute.
Return Value
Type: AFAttributeReturns the first child AFAttribute identified by the trait parameter. All attributes are searched, including nested child attributes. Returns if an AFAttribute with the specified trait does not exist.
Remarks
The first child AFAttribute with the specified trait is returned.