This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Get A SchematicAttribute Related To A SchematicElementClass Snippet (ArcObjects .NET 10.4 SDK) |
Retrieve a SchematicAttribute related to a given SchematicElementClass from its name
/// <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); }
''' <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