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

IEditor.EditSelection Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IE > IEditor Interface > IEditor.EditSelection Property
ArcGIS Developer Help

IEditor.EditSelection Property

The selected features which are editable.

[Visual Basic .NET]
Public ReadOnly Property EditSelection As IEnumFeature
public IEnumFeature EditSelection {get;}

Product Availability

Available with ArcGIS Desktop.


public void GetMapSelection()
  //Get a reference to IApplication app in ICommand::OnCreate hook parameter.
  IEditor sEditor = app.FindExtensionByName("ESRI Object Editor") as IEditor;
  IEnumFeature enumFeature = sEditor.EditSelection;
  IFeature selFeature = enumFeature.Next();
  for (int fCount = 0; fCount < sEditor.SelectionCount; fCount++)
    IGeometry selGeometry = selFeature.Shape;
    'Put code here to do something with the geometry
     selFeature = enumFeature.Next;


This property returns all of the currently selected features that belong to editable layers. Use this property when creating an editing tool or command that works with the current selection.
public void GetMapSelection()
    //get editor extension
    UID editorUID = new UID();
    editorUID.Value = "esriEditor.Editor";
    IEditor editor = m_application.FindExtensionByCLSID(editorUID) as IEditor;
    IEnumFeature selectedFeatures = editor.EditSelection as IEnumFeature;
    IFeature currentFeature = selectedFeatures.Next();
    while(currentFeature != null)
        IGeometry geometry = currentFeature.Shape;
        //Code to do something with the geometry
        //In this example we'll msgbox the geometry type
        currentFeature = selectedFeatures.Next();
[Visual Basic .NET]
Private sub GetEditSel() 'Get Iapplication from
  ICommand::OnCreate hook parameter. 
Dim geometry as IGeometry
Dim enumFeature As IEnumFeature
Dim feature as IFeature
Dim fieldCount As Integer

'Get an object reference to IEditor. 
Dim  editorUID As UID = New UIDClass()
 editorUID.Value =  "esriEditor.Editor"
  Dim editor As IEditor = app.FindExtensionByCLSID(editorUID) 
  enumFeature = editor.EditSelection
feature = enumFeature.Next 
If feature Is Nothing
Then m_Editor.AbortOperation() 
   Exit Sub 
 End If
 For fieldCount = 0 To editor.SelectionCount - 1 
 origPartGeometry = enumFeature.Shape 

   'Code to do something with the geometry. 'In this example we'll messagebox the geometry type
origFeature = enumFeature.Next
Next fieldCount
End Sub


See Also

IEditor Interface