ArcGIS Pro 2.9 API Reference Guide
SetDefinitionQuery Method (BasicFeatureLayer)

ArcGIS.Desktop.Mapping Namespace > BasicFeatureLayer Class : SetDefinitionQuery Method
A SQL expression.
Sets the definition query expression for the layer. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void SetDefinitionQuery( 
   string definitionQuery
)
Public Sub SetDefinitionQuery( _
   ByVal definitionQuery As String _
) 

Parameters

definitionQuery
A SQL expression.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
This method cannot be called if the feature layer is a member of SubtypeGroupLayer. Use the IsSubtypeLayer property to determine if the feature layer is a member of a SubtypeGroupLayer.
Remarks
This allows you to filter features from the layer by specifying definition query as you would in the Definition Query tab of the layer's properties dialog.
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

BasicFeatureLayer Class
BasicFeatureLayer Members