ArcGIS Explorer Component Help |
Subtypes..::.GetSubtypeValueNamePairs Method |
Subtypes Class Example See Also |
Gets a SortedList of subtype value/name pairs.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public SortedList<int, string> GetSubtypeValueNamePairs() |
Visual Basic (Declaration) |
---|
Public Function GetSubtypeValueNamePairs As SortedList(Of Integer, String) |
Return Value
A SortedList containing value/name pairs of all the defined subtypes.Examples
The code below demonstrates how to access the subtypes in a Table. The Table.IsSubtyped property is used
to check that the Table is subtyped and the ColumnCollection.Subtypes property returns the Subtypes object.
The GetSubtypeValueNamePairs method is used to return a sorted list of all the subtypes, which is iterated over
to print out all the value/name pairs.
CopyC#
//Open the Buildings feature class Table buildings = Table.OpenFileGeodatabaseTable(@"C:\Data\CalgaryData2.gdb", "Buildings"); //Check that the Table is subtyped if (buildings.IsSubtyped) { //Return the Subtypes from the ColumnCollection Subtypes subs = buildings.Columns.Subtypes; //Print the name of the Column which manages the subtypes System.Diagnostics.Debug.Print(subs.SubtypeColumnName); //Prints "BLDG_CODE" //Return a sorted list (value/description name) containing all the subtypes SortedList<int, string> subtypesList = subs.GetSubtypeValueNamePairs(); //Print out the contents of the subtypes for (int i = 0; i < subs.Count-1; i++) { //Each Key is the subtype value System.Diagnostics.Debug.Print(subtypesList.Keys[i].ToString()); //Each Value is the subtype descriptive name System.Diagnostics.Debug.Print(subtypesList.Values[i].ToString()); } }
CopyVB.NET
'Open the Buildings feature class Dim buildings As Table = Table.OpenFileGeodatabaseTable("C:\Data\CalgaryData2.gdb", "Buildings") 'Check that the Table is subtyped If (buildings.IsSubtyped) Then 'Return the Subtypes from the ColumnCollection Dim subs As Subtypes = buildings.Columns.Subtypes 'Print the name of the Column which manages the subtypes System.Diagnostics.Debug.Print(subs.SubtypeColumnName) 'Prints "BLDG_CODE" 'Return a sorted list (value/description name) containing all the subtypes Dim subtypesList As SortedList(Of Integer, String) = subs.GetSubtypeValueNamePairs() 'Print out the contents of the subtypes For i As Integer = 0 To subs.Count - 1 'Each Key is the subtype value System.Diagnostics.Debug.Print(subtypesList.Keys.Item(i).ToString()) 'Each Value is the subtype descriptive name System.Diagnostics.Debug.Print(subtypesList.Values.Item(i).ToString()) Next End If