public IReadOnlyList<Subtype> GetSubtypes()
Public Function GetSubtypes() As IReadOnlyList(Of Subtype)
Return Value
A IReadOnlyList of the table's subtype codes.
public IReadOnlyList<Subtype> GetSubtypes()
Public Function GetSubtypes() As IReadOnlyList(Of Subtype)
Exception | Description |
---|---|
System.NotSupportedException | The definition does not support this operation (e.g., the table is a shapefile). |
ArcGIS.Core.Data.Exceptions.GeodatabaseException | A geodatabase-related exception has occurred. |
public string GetDomainStringFromField(Row row, Field field) { // Get the table and table definition from the Row using (Table table = row.GetTable()) using (TableDefinition tableDefinition = table.GetDefinition()) { // Get name of subtype field string subtypeFieldName = tableDefinition.GetSubtypeField(); // Get subtype, if any Subtype subtype = null; if (subtypeFieldName.Length != 0) { // Get value of subtype field for this row object varSubtypeCode = row[subtypeFieldName]; long subtypeCode = (long)varSubtypeCode; // Get subtype for this row subtype = tableDefinition.GetSubtypes().First(x => x.GetCode() == subtypeCode); } // Get the coded value domain for this field CodedValueDomain domain = field.GetDomain(subtype) as CodedValueDomain; // Return the text string for this field if (domain != null) { return domain.GetName(row[field.Name]); } else { return row[field.Name].ToString(); } } }
Target Platforms: Windows 11, Windows 10