ArcObjects Library Reference (Carto)  

IActiveView.Selection Property

The selection.

[Visual Basic .NET]
Public Property Selection As ISelection
[C#]
public ISelection Selection {get; set;}
[C++]
HRESULT get_Selection(
  ISelection** Selection
);
[C++]
HRESULT putref_Selection(
  ISelection* Selection
);
[C++]

Parameters

Selection [out, retval]

  Selection is a parameter of type ISelection

Selection [in]

  Selection is a parameter of type ISelection

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

ArcMap has two different selection types, a feature selection and an element selection. Two different objects represent these selections and both implement the ISelection interface. The feature selection object additionally implements IEnumFeature and the element selection object IEnumElement. The ISelection interface is used for clipboard type operations and the IEnum interfaces are used to loop through the items in the collection.

Each active view object, the PageLayout and all Maps, have their own selection objects.  Actually, the PageLayout only has an element selection but each Map has a unique feature and element selection. When working with selections make sure you have the correct active view object. 

For a Map, only one of the selections can be active at a time.  As mentioned above, this interface provides an ISelection reference to either an element or feature selection depending on which one is currently active. To simplify the matter, IMap has a FeatureSelection property which always returns an ISelection on the feature selection, from which you can obtain an IEnumFeature reference. Just make sure you have the correct Map, usually the FocusMap. To get a Map's element selection, use IViewManager::ElementSelection.

Note: The features returned as part of IEnumFeature are in the spatial reference of the map, so they have the coordinate system and the resolution (1/precision) of the map.

 

See Also

IActiveView Interface | IMap.FeatureSelection Property | IGraphicsContainerSelect Interface | IActiveView.Selection Property | IEnumElement Interface