This document is archived and information here might be outdated.  Recommended version.


Get A SchematicAttribute Related To A SchematicElementClass Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Get A SchematicAttribute Related To A SchematicElementClass Snippet

Retrieve a SchematicAttribute related to a given SchematicElementClass from its name

[C#]
        /// <summary>
        /// Retrieve a SchematicAttribute related to a given SchematicElementClass from its name
        /// </summary>
        /// <param name="schemElementClass">The SchematicElementClass the attribute is related to</param>
        /// <param name="AttributeName">The schematic attribute name</param>
        /// <returns>The retrieved ESRI.ArcGIS.Schematic.ISchematicAttribute</returns>
        public ESRI.ArcGIS.Schematic.ISchematicAttribute GetSchematicAttributeFromElementClassByName(ESRI.ArcGIS.Schematic.ISchematicElementClass schemElementClass, string AttributeName)
        {
                // cast SchematicElementClass into ISchematicAttributeContainer
                ESRI.ArcGIS.Schematic.ISchematicAttributeContainer schAttributeCont=(ESRI.ArcGIS.Schematic.ISchematicAttributeContainer)schemElementClass;

                // the second parameter is set to True for a recursive search
                return schAttributeCont.GetSchematicAttribute(AttributeName, true);
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Retrieve a SchematicAttribute related to a given SchematicElementClass from its name
        ''' </summary>
        ''' <param name="schemElementClass">The SchematicElementClass the attribute is related to</param>
        ''' <param name="AttributeName">The schematic attribute name</param>
        ''' <returns>The retrieved ESRI.ArcGIS.Schematic.ISchematicAttribute</returns>
        Public Function GetSchematicAttributeFromElementClassByName(ByVal schemElementClass As ESRI.ArcGIS.Schematic.ISchematicElementClass, ByVal AttributeName As String) As ESRI.ArcGIS.Schematic.ISchematicAttribute

                ' cast SchematicElementClass into ISchematicAttributeContainer
                Dim schAttributeCont As ESRI.ArcGIS.Schematic.ISchematicAttributeContainer=TryCast(schemElementClass, ESRI.ArcGIS.Schematic.ISchematicAttributeContainer)

                ' the second parameter is set to True for a recursive search
                Return schAttributeCont.GetSchematicAttribute(AttributeName, True)
        End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Schematic