Prefer this function over direct access to the Layers collection, especially if you're on the GUI thread.
Layer collections are modified on the worker thread, so using this function will ensure proper synchronization.
Requirements
Target Platforms: Windows 11, Windows 10, Windows 8.1