ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork Namespace / Association Class
Members Example

In This Topic
    Association Class
    In This Topic
    Represents a connectivity (spatial and non-spatial), containment, or structural attachment association.
    Object Model
    Association ClassElement ClassElement Class
    Syntax
    public class Association : System.IEquatable<Association>  
    Public Class Association 
       Implements System.IEquatable(Of Association) 
    Remarks
    Association objects are not reflected in the topological index if they have not yet been validated with UtilityNetwork.ValidateNetworkTopology.
    Example
    Get traverse associations result from downward traversal
    public static void GetTraverseAssociationsResultFromDownwardTraversal(UtilityNetwork utilityNetwork, IReadOnlyList<Element> startingElements)
    {
      // Set downward traversal with maximum depth
      TraverseAssociationsDescription traverseAssociationsDescription = new TraverseAssociationsDescription(TraversalDirection.Descending);
    
      // Get traverse associations result from the staring element up to maximum depth
      TraverseAssociationsResult traverseAssociationsResult = utilityNetwork.TraverseAssociations(startingElements, traverseAssociationsDescription);
    
      // Get associations participated in traversal
      IReadOnlyList<Association> associations = traverseAssociationsResult.Associations;
    }
    Get traverse associations result from upward traversal with depth limit
    public static void GetTraverseAssociationsResultFromUpwardTraversalWithDepthLimit(UtilityNetwork utilityNetwork, IReadOnlyList<Element> startingElements)
    {
      // List of fields whose values will be fetched as name-values pairs during association traversal operation
      List<string> additionalFieldsToFetch = new List<string> { "ObjectId", "AssetName", "AssetGroup", "AssetType" };
    
      // Set downward traversal with maximum depth level of 3 
      TraverseAssociationsDescription traverseAssociationsDescription = new TraverseAssociationsDescription(TraversalDirection.Ascending, 3)
      {
        AdditionalFields = additionalFieldsToFetch
      };
    
      // Get traverse associations result from the staring element up to depth level 3
      TraverseAssociationsResult traverseAssociationsResult = utilityNetwork.TraverseAssociations(startingElements, traverseAssociationsDescription);
    
      // List of associations participated in traversal
      IReadOnlyList<Association> associations = traverseAssociationsResult.Associations;
    
      // KeyValue mapping between involved elements and their field name-values 
      //At 2.x - IReadOnlyDictionary<Element, IReadOnlyList<AssociationElementFieldValue>> associationElementValuePairs = traverseAssociationsResult.AdditionalFieldValues;
      IReadOnlyDictionary<Element, IReadOnlyList<FieldValue>> associationElementValuePairs =
        traverseAssociationsResult.AdditionalFieldValues;
    
      foreach (KeyValuePair<Element, IReadOnlyList<FieldValue>> keyValuePair in associationElementValuePairs)
      {
        // Element 
        Element element = keyValuePair.Key;
    
        // List of field names and their values 
        //At 2.x - IReadOnlyList<AssociationElementFieldValue> elementFieldValues = keyValuePair.Value;
        IReadOnlyList<FieldValue> elementFieldValues = keyValuePair.Value;
      }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.UtilityNetwork.Association
          ArcGIS.Core.Data.UtilityNetwork.AssociationFeature

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also