AFEnumerationSet Class
- Last UpdatedNov 18, 2025
- 14 minute read
- PI System
- AF SDK 2024 R2
- Developer
The AFEnumerationSet represents a user-defined set of named constant values.
It is also used to represent a PI Digital State Set.

Inheritance Hierarchy
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[SerializableAttribute] public sealed class AFEnumerationSet : AFObject, IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFEnumerationSet>, IList<AFEnumerationValue>, ICollection<AFEnumerationValue>, IEnumerable<AFEnumerationValue>, IEnumerable, IList, ICollection
<SerializableAttribute> Public NotInheritable Class AFEnumerationSet Inherits AFObject Implements IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable(Of AFEnumerationSet), IList(Of AFEnumerationValue), ICollection(Of AFEnumerationValue), IEnumerable(Of AFEnumerationValue), IEnumerable, IList, ICollection Dim instance As AFEnumerationSet
[SerializableAttribute] public ref class AFEnumerationSet sealed : public AFObject, IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFEnumerationSet^>, IList<AFEnumerationValue^>, ICollection<AFEnumerationValue^>, IEnumerable<AFEnumerationValue^>, IEnumerable, IList, ICollection
[<SealedAttribute>] [<SerializableAttribute>] type AFEnumerationSet = class inherit AFObject interface IAFTransactable interface IAFChangedEvent interface IAFSecurable interface IComparable<AFEnumerationSet> interface IList<AFEnumerationValue> interface ICollection<AFEnumerationValue> interface IEnumerable<AFEnumerationValue> interface IEnumerable interface IList interface ICollection end
The AFEnumerationSet type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| AFEnumerationSet |
Initializes a new instance of the class with default values.
| |
| AFEnumerationSet(String) |
Initializes a new instance of the class with the specified name.
|
Properties
| Name | Description | |
|---|---|---|
| CheckOutInfo |
This read-only property returns the checked out status information for the object.
| |
| Count |
Gets the number of items actually contained in the collection.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
| |
| Description |
Read/write property that provides a more detailed description of the object.
| |
| ID |
Read-only property that provides a unique identifier for the object to be used for
quick access that is not dependent upon the index.
(Inherited from AFObject.) | |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| IsDirty |
This read-only property indicates whether the object has been modified since the
last save to the PI AF Server.
| |
| IsNew |
This read-only property indicates whether the object is new and has never been saved
to the PI AF Server.
| |
| ItemGuid |
Gets the item with the specified id.
| |
| ItemInt32 |
Gets or sets the item at the specified index.
| |
| ItemString |
Returns the specified object from the collection by name.
| |
| Name |
Read/write property that identifies the name of the object.
| |
| PIServer |
Returns a reference to the PIServer associated with this AFEnumerationSet
or if it is not associated with one.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| Security |
This read-only property returns the AFSecurity information for the object.
| |
| SystemStateSet |
The standard system enumeration set.
| |
| UniqueID |
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.) |
Methods
| Name | Description | |
|---|---|---|
| Add(AFEnumerationValue) |
The Add method adds the specified AFEnumerationValue to the AFEnumerationSet.
| |
| Add(String, Int32) |
The Add method creates a new AFEnumerationValue and adds it to
the collection with the specified name and value.
| |
| ApplyChanges |
This method applies the changes to the object and makes
those changes available to other objects for the current user.
| |
| AreEquivalent |
This method compares two AFEnumerationSet objects for equivalence.
| |
| CheckIn |
This method checks in (commits) all the changes to the object by saving
the information to persistent storage.
| |
| CheckOut |
This method locks the object so that its configuration can be modified.
| |
| CheckOutEnumerationSets |
Check out the objects with the specified unique identifiers at the specified query date.
| |
| Clear |
Removes all items from the collection.
| |
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| Contains(Guid) |
This method determines whether the collection contains a specific item referenced by id.
| |
| Contains(Int32) |
This method determines whether the collection contains a specific item value.
| |
| Contains(String) |
This method determines whether the collection contains a specific item referenced by name.
| |
| Contains(AFEnumerationValue) |
This method determines whether the collection contains a specific item.
| |
| CopyTo |
Copies the entire collection to a compatible one-dimensional Array,
starting at the specified index of the target array.
| |
| DeleteEnumerationSets |
Delete the objects with the specified unique identifiers.
| |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.) | |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| FindEnumerationSet |
Retrieves the AFEnumerationSet object with the specified unique identifier.
| |
| FindEnumerationSets(PISystem, Guid) |
Performs a search within the PISystem to retrieve a collection
of AFEnumerationSet objects with the specified list of unique identifiers.
| |
| FindEnumerationSets(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32) |
Performs a non-paged text search within the AFDatabase to retrieve a collection
of AFEnumerationSet objects which have a field that match the specified query string.
| |
| GetBySystemStateCode | ||
| GetByValue |
Gets the specified AFEnumerationValue from the collection
by its value.
| |
| GetEnumerator |
Returns an enumerator that iterates through the collection.
| |
| GetHashCode |
Gets the hash code for this instance of the object which is suitable for use in hashing
algorithms and data structures like a hash table.
(Inherited from AFObject.) | |
| GetPath |
Returns the full path to the object, using just the names.
(Inherited from AFObject.) | |
| GetPath(AFObject) |
Returns the path to the object relative from another object.
(Inherited from AFObject.) | |
| GetPath(AFEncodeType, AFObject) |
Returns the path to the object relative from another object,
using the name and/or id as specified
by encodeType.
(Inherited from AFObject.) | |
| GetSecurity |
Gets the AFSecurity information of the specified security item
associated with the object.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IndexOf |
Searches for the specified object and returns the zero-based index of the first
occurrence within the entire collection.
| |
| LoadEnumerationSets(IListAFEnumerationSet) |
Loads the specified list AFEnumerationSet objects.
| |
| LoadEnumerationSets(PISystem, Guid) |
Loads the AFEnumerationSet objects with the specified unique identifiers.
| |
| Persist |
This method returns the persistence string for the object.
(Overrides AFObjectPersist.) | |
| Refresh |
Refreshes the client with any changes that have been made to the object since loaded.
| |
| Remove(Guid) |
Removes the item with the specified id from the collection.
| |
| Remove(Int32) |
The Remove method removes the item from the collection by its value.
| |
| Remove(String) |
The Remove method removes the item from the collection by name.
| |
| Remove(AFEnumerationValue) |
Removes the first occurrence of a specific object from the collection.
| |
| RemoveAt |
Removes the item at the specified index of the collection.
| |
| Sort |
Sorts the items in the entire collection using the default comparer.
| |
| Sort(IComparerAFEnumerationValue) |
Sorts the items in the entire collection using the specified comparer.
| |
| Sort(Int32, Int32, IComparerAFEnumerationValue) |
Sorts the items in a range of items in the collection using the specified comparer.
| |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) | |
| UndoCheckOut |
This method discards all the changes to the object and all sub-objects since the
last call to CheckOut. Any changes since the check out will be lost.
|
Events
| Name | Description | |
|---|---|---|
| Changed |
Event is raised when the object or one of its sub-objects is changed.
|
Extension Methods
| Name | Description | |
|---|---|---|
| AggregateAFEnumerationValue |
Performs all requested aggregates on the specified items.
(Defined by AFAggregate.) | |
| AggregateAsyncAFEnumerationValue |
Performs all requested aggregates on the specified items asynchronously.
(Defined by AFAggregate.) | |
| BinnedSummaryAFEnumerationValue, TBin |
Generates a summary broken down by the specified bins for items matching the search criteria.
(Defined by AFAggregate.) | |
| BinnedSummaryAsyncAFEnumerationValue, TBin |
Generates a summary broken down by the specified bins for items matching the search criteria asynchronously.
(Defined by AFAggregate.) | |
| ChunkedByAFEnumerationValue |
This extension method breaks up search results into chunks to make it easier to
page through and process IEnumerableT collections in chunks.
(Defined by AFSDKExtension.) | |
| FrequencyDistributionAFEnumerationValue |
Generates a frequency distribution for the specified items.
(Defined by AFAggregate.) | |
| FrequencyDistributionAsyncAFEnumerationValue |
Generates a frequency distribution for the specified items asynchronously.
(Defined by AFAggregate.) | |
| GroupedSummaryAFEnumerationValue |
Generates a summary broken down by group for the specified items.
(Defined by AFAggregate.) | |
| GroupedSummaryAsyncAFEnumerationValue |
Generates a histogram for the specified items asynchronously.
(Defined by AFAggregate.) | |
| HistogramAFEnumerationValue, TBin |
Generates a histogram for the specified items with the specified weighting.
(Defined by AFAggregate.) | |
| HistogramAsyncAFEnumerationValue, TBin |
Generates a histogram for the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.) | |
| SummaryAFEnumerationValue(String, AFSummaryTypes) | Overloaded.
Summarizes the specified items.
(Defined by AFAggregate.) | |
| SummaryAFEnumerationValue(String, AFSummaryTypes, String) | Overloaded.
Summarizes the specified items with the specified weighting.
(Defined by AFAggregate.) | |
| SummaryAsyncAFEnumerationValue(String, AFSummaryTypes, CancellationToken) | Overloaded.
Summarizes the specified items asynchronously.
(Defined by AFAggregate.) | |
| SummaryAsyncAFEnumerationValue(String, AFSummaryTypes, String, CancellationToken) | Overloaded.
Summarizes the specified items with the specified weighting asynchronously.
(Defined by AFAggregate.) |
Remarks
The collection of available enumeration sets is maintained by the
AFDatabase and PIServer. The SystemStateSet property returns the standard
system enumeration set.
Examples
// This example demonstrates how to create an enumeration // value type and add it as the type of an attribute, // as well as setting a value with it. // Get the Database PISystems myPISystems = new PISystems(); AFDatabase myDB = myPISystems.DefaultPISystem.Databases.DefaultDatabase; // Create the Enumeration Set AFEnumerationSet myEnumerationSet = myDB.EnumerationSets.Add("Speed"); myEnumerationSet.Description = "Motor Speeds"; // Add the Enumeration Values myEnumerationSet.Add("Stop", 0); myEnumerationSet.Add("Slow", 1); myEnumerationSet.Add("Medium", 5); myEnumerationSet.Add("Fast", 10); // Display the Name and Description of the EnumerationSet Console.WriteLine("Name of EnumerationSet = {0}", myEnumerationSet.Name); Console.WriteLine("Description = {0}", myEnumerationSet.Description); // Display each value in the EnumerationSet foreach (AFEnumerationValue eVal in myEnumerationSet) { Console.WriteLine("Name in set = {0}", eVal.Name); Console.WriteLine("Value in set = {0}", eVal.Value); } // Create an Element AFElement myElement = myDB.Elements.Add("MyElement"); // Create an Attribute AFAttribute myAttribute = myElement.Attributes.Add("MyAttribute"); // Set the EnumerationSet for an Attibute myAttribute.TypeQualifier = myEnumerationSet; myAttribute.SetValue(myEnumerationSet["Stop"], null);
' This example demonstrates how to create an enumeration ' value type and add it as the type of an attribute, ' as well as setting a value with it. ' Get the Database Dim myPISystems As New PISystems() Dim myDB As AFDatabase = myPISystems.DefaultPISystem.Databases.DefaultDatabase ' Create the Enumeration Set Dim myEnumerationSet As AFEnumerationSet = myDB.EnumerationSets.Add("Speed") myEnumerationSet.Description = "Motor Speeds" ' Add the Enumeration Values myEnumerationSet.Add("Stop", 0) myEnumerationSet.Add("Slow", 1) myEnumerationSet.Add("Medium", 5) myEnumerationSet.Add("Fast", 10) ' Display the Name and Description of the EnumerationSet Console.WriteLine("Name of EnumerationSet = {0}", myEnumerationSet.Name) Console.WriteLine("Description = {0}", myEnumerationSet.Description) ' Display each value in the EnumerationSet Dim eVal As AFEnumerationValue For Each eVal In myEnumerationSet Console.WriteLine("Name in set = {0}", eVal.Name) Console.WriteLine("Value in set = {0}", eVal.Value) Next eVal ' Create an Element Dim myElement As AFElement = myDB.Elements.Add("MyElement") ' Create an Attribute Dim myAttribute As AFAttribute = myElement.Attributes.Add("MyAttribute") ' Set the EnumerationSet for an Attribute myAttribute.TypeQualifier = myEnumerationSet myAttribute.SetValue(myEnumerationSet("Stop"), Nothing)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.