AFPorts.Add Method (String, String, AFPortType, Boolean)
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
The Add method creates a new object and adds it to the collection.
Namespace: OSIsoft.AF.Modeling
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public AFPort Add( string name, string description, AFPortType portType, bool isDefault )
Public Function Add ( name As String, description As String, portType As AFPortType, isDefault As Boolean ) As AFPort Dim instance As AFPorts Dim name As String Dim description As String Dim portType As AFPortType Dim isDefault As Boolean Dim returnValue As AFPort returnValue = instance.Add(name, description, portType, isDefault)
public: AFPort^ Add( String^ name, String^ description, AFPortType portType, bool isDefault )
member Add : name : string * description : string * portType : AFPortType * isDefault : bool -> AFPort
Parameters
- name
- Type: SystemString
The name for the new object, which must be unique within the collection. If the name ends with an asterisk (*), then a unique name will be generated based on the supplied name. See the ValidateName(String, String) method for a description of what is valid when setting the name of the object. - description
- Type: SystemString
The description for the newly created port. - portType
- Type: OSIsoft.AF.ModelingAFPortType
The AFPortType of the newly created port. - isDefault
- Type: SystemBoolean
Set to if the newly created port is to be the default port for the specified portType. If and there is no default port, this port will still be set as the default port.
Return Value
Type: AFPortReturns the newly created object that was added to the collection.
Remarks
The new object will be created with the specified name. All other
properties of the object will be set to their default value.