ArcGIS Pro 2.6 API Reference Guide
GetSelection Method (Map)
Example 

ArcGIS.Desktop.Mapping Namespace > Map Class : GetSelection Method
Get the selection for the map. This method must be called on the MCT. Use QueuedTask.Run
Syntax

Return Value

The selection in the map represented by the collection of layers and tables and their corresponding object ids.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Example
Flash the map's selcted features.
public Task FlashSelectedFeaturesAsync()
{
  return QueuedTask.Run(() =>
  {
    //Get the active map view.
    var mapView = MapView.Active;
    if (mapView == null)
      return;

    //Get the selected features from the map and filter out the standalone table selection.
    var selectedFeatures = mapView.Map.GetSelection()
      .Where(kvp => kvp.Key is BasicFeatureLayer)
      .ToDictionary(kvp => (BasicFeatureLayer)kvp.Key, kvp => kvp.Value);

    //Flash the collection of features.
    mapView.FlashFeature(selectedFeatures);
  });

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

Map Class
Map Members