ArcGIS Pro 2.7 API Reference Guide
DeleteElements(Func<Element,Boolean>) Method
Example 

ArcGIS.Desktop.Layouts Namespace > Layout Class > DeleteElements Method : DeleteElements(Func<Element,Boolean>) Method
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.
Deletes an array of elements on a page layout. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void DeleteElements( 
   Func<Element,bool> predicate
)
Public Overloads Sub DeleteElements( _
   ByVal predicate As Func(Of Element,Boolean) _
) 

Parameters

predicate
Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Example
//Delete multiple layout elements.

//Perform on the worker thread
await QueuedTask.Run(() =>
{
  layout.DeleteElements(item => item.Name.Contains("Clone"));
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

Layout Class
Layout Members
Overload List