ArcGIS Pro 2.7 API Reference Guide
GetSelectedLayers Method
Example 

ArcGIS.Desktop.Mapping Namespace > MapView Class : GetSelectedLayers Method
Returns the collection of layers selected in the TOC.
Syntax
public IReadOnlyList<Layer> GetSelectedLayers()
Public Function GetSelectedLayers() As IReadOnlyList(Of Layer)

Return Value

The collection of layers selected in the TOC.
Example
Zoom to the selected layers in the TOC.
public Task<bool> ZoomToTOCSelectedLayersAsync()
{
  //Get the active map view.
  var mapView = MapView.Active;
  if (mapView == null)
    return Task.FromResult(false);

  //Zoom to the selected layers in the TOC
  var selectedLayers = mapView.GetSelectedLayers();
  return mapView.ZoomToAsync(selectedLayers);
}
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MapView Class
MapView Members