Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFConnections.Add Method (AFPort, AFPort)

  • Last UpdatedNov 18, 2025
  • 2 minute read
AFConnections.Add Method (AFPort, AFPort)
The Add method creates a new connection between ports of two elements in the model.

Namespace:  OSIsoft.AF.Modeling
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public AFConnection Add(
	AFPort sourcePort,
	AFPort destinationPort
)
Public Function Add ( 
	sourcePort As AFPort,
	destinationPort As AFPort
) As AFConnection

Dim instance As AFConnections
Dim sourcePort As AFPort
Dim destinationPort As AFPort
Dim returnValue As AFConnection

returnValue = instance.Add(sourcePort, 
	destinationPort)
public:
AFConnection^ Add(
	AFPort^ sourcePort, 
	AFPort^ destinationPort
)
member Add : 
        sourcePort : AFPort * 
        destinationPort : AFPort -> AFConnection 

Parameters

sourcePort
Type: OSIsoft.AF.ModelingAFPort
The source AFPort object of the connection. The port type must be either Output or Undirected.
destinationPort
Type: OSIsoft.AF.ModelingAFPort
The destination AFPort object of the connection. The port type must be either Input or Undirected.

Return Value

Type: AFConnection
Returns the newly created object that was added.

Exceptions

ExceptionCondition
InvalidOperationException Thrown if the connection between the specified sourcePort and destinationPort is not valid.

Remarks

The two elements being connected must already be defined for the model. The direction of connection is determined by the order of the parameters and the port types being connected. See documentation about AFPortType for more information. The rules for allowed connections is controlled by the definition of the AFPort objects being connected. If you want to connect the default ports of two elements, it is convenient to use the AFBaseElement.DefaultInputPort, AFBaseElement.DefaultOutputPort, or AFBaseElement.DefaultUndirectedPort properties.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in