ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureSceneLayer Class / GetSelection Method
Example

In This Topic
    GetSelection Method (FeatureSceneLayer)
    In This Topic
    Gets the current selection. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Selection GetSelection()
    Public Function GetSelection() As Selection

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    No associated feature service
    Remarks
    GetSelection() can only be used on feature scene layers that have an associated feature service. Check HasAssociatedFeatureService property to determine if the FeatureSceneLayer has an associated feature service. Calling GetSelection() on a FeatureSceneLayer with no associated feature service will throw a System.InvalidOperationException
    Example
    Delete all the selected features in FeatureSceneLayer
    //must support editing!
    //var featSceneLayer = .... ;
    if (!featSceneLayer.HasAssociatedFeatureService || 
        !featSceneLayer.IsEditable)
      return;
    
    var delOp = new EditOperation()
    {
      Name = "Delete selected features"
    };
    //Assuming we have a selection on the layer...
    delOp.Delete(featSceneLayer, featSceneLayer.GetSelection().GetObjectIDs());
    await delOp.ExecuteAsync();//await if needed but not required
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also