private void ClearLayers() { if (ChildLayers.Any()) { foreach (Layer child in ChildLayers.ToList()) { // Fixes memory leak on refresh. Remove individual layers so each layer will be teared down properly by GroupLayer. // ChildLayers.Clear() will cause a reset event, which will not contain NewItems/OldItems so they can be unsubscribed ChildLayers.Remove(child); } } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.