//C# private void SelectFeatures(IGeometry selectionShape, IFeatureLayer layer) { IFeatureClass featureClass = layer.FeatureClass; ISpatialFilter filter = new SpatialFilterClass(); filter.Geometry = selectionShape; filter.GeometryField = featureClass.ShapeFieldName; filter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; ISelectionSet selectionSet = featureClass.Select(filter, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, null); IEnumIDs enumIds = selectionSet.IDs; enumIds.Reset(); int objectID = enumIds.Next(); IFeature feature = null; List<string> fieldNames = GetFieldNames(featureClass); while (objectID != -1) { feature = featureClass.GetFeature(objectID); foreach (string name in fieldNames) { System.Diagnostics.Debug.WriteLine("Field " + name + " : " + feature.get_Value(featureClass.FindField(name))); } objectID = enumIds.Next(); } IFeatureSelection selection = layer as IFeatureSelection; selection.SelectionSet = selectionSet; this.axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, layer, this.axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds); selection.SelectionChanged(); this.axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, layer, this.axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds); } private List<string> GetFieldNames(IFeatureClass featureClass) { IFields fields = featureClass.Fields; List<string> fieldNames = new List<string>(); IField field = null; for (int i = 0; i < fields.FieldCount; i++) { field = fields.get_Field(i); if (field.Type != esriFieldType.esriFieldTypeGeometry) { fieldNames.Add(field.Name); } } return fieldNames; }