This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Loop On The Schematic Element Associations Related To A Schematic Element Class Snippet (ArcObjects .NET 10.4 SDK) |
Looping on all the schematic element associations for a given schematic element class
/// <summary> /// Looping on all the Schematic Element Associations of a SchematicElementClass /// </summary> /// <param name="schemElementClass">The SchematicElementClass on which you want to work</param> public void SchematicElementAssociationFromElementClass(ESRI.ArcGIS.Schematic.ISchematicElementClass schemElementClass) { // cast SchematicElementClass into ISchematicElementAssociationContainer ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer schElementAssociationCont=(ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer)schemElementClass; // get all the related Schematic Element Associations ESRI.ArcGIS.Schematic.IEnumSchematicElementAssociation enumElementAssociation=schElementAssociationCont.SchematicElementAssociations; enumElementAssociation.Reset(); // get the first SchematicElementAssociation ESRI.ArcGIS.Schematic.ISchematicElementAssociation schElementAssociation=enumElementAssociation.Next(); bool isOk=false; while (schElementAssociation != null) { // TODO: add your code here, set isOk to true to exit the loop if (isOk) break; // get the next SchematicElementAssociation schElementAssociation=enumElementAssociation.Next(); } }
''' <summary> ''' Looping on all the Schematic Element Associations of a SchematicElementClass ''' </summary> ''' <param name="schemElementClass">The SchematicElementClass on which you want to work</param> Public Sub SchematicElementAssociationFromElementClass(ByVal schemElementClass As ESRI.ArcGIS.Schematic.ISchematicElementClass) ' cast SchematicElementClass into ISchematicElementAssociationContainer Dim schElementAssociationCont As ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer=TryCast(schemElementClass, ESRI.ArcGIS.Schematic.ISchematicElementAssociationContainer) ' get all the related Schematic Element Associations Dim enumElementAssociation As ESRI.ArcGIS.Schematic.IEnumSchematicElementAssociation=schElementAssociationCont.SchematicElementAssociations enumElementAssociation.Reset() ' get the first SchematicElementAssociation Dim schElementAssociation As ESRI.ArcGIS.Schematic.ISchematicElementAssociation=enumElementAssociation.Next() Dim isOk As Boolean=False While (schElementAssociation IsNot Nothing) ' TODO: add your code here, set isOk to true to exit the loop If (isOk) Then Exit While ' get the next SchematicElementAssociation schElementAssociation=enumElementAssociation.Next() End While End Sub