The following code snippet shows how to get information such as Name, Description and Color of the defined enumeration values for an Attribute Type using the SystemWeaver API:


IswAttributeType attributeType = SWConnection.Instance.Broker.AttributeType("ATT4");


Example

 IswAttributeType attributeType = SWConnection.Instance.Broker.AttributeType("ATT4");
                 
            // Check if it is an enumeration
            if (attributeType.DataType.Equals(SWAttributeDataType.Enumeration))
            {
                // Get defined enumeration Values as string[]
                string[] enumValuesAsString = attributeType.RangeArray;

                // Get defined enumeration Values as SWEnumerationAttributeRange
                byte[] typeRange = attributeType.Range;

                // if attribute type is not an enumeration, the below result will be an empty SWEnumerationAttributeRange
                SWEnumerationAttributeRange enumAttributeValues = new SWEnumerationAttributeRange(typeRange);

                foreach (EnumerationAttributeRange enumerationValue in enumAttributeValues)
                {
                    string valueName = enumerationValue.Name;
                    string valueDescription = enumerationValue.Description;
                    Color? valueColor = enumerationValue.Color;                    
                }
            }