Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a group layer. Its purpose is to show feature layers over a base map. Those feature layers are logically grouped into categories and we provide the ability to add/remove whole categories through a menu.

The categorization is done using a dictionary

layerCategories <string [category name], List<IFeatureLayer>>

When I want to delete a category, I do something like the following

void deleteCategory( string categoryName){
  foreach(var layer in layerCategories[categoryName]){
    theGrouLayer.Delete(layer); // delete layer from group layer
  }
  layerCategories.Remove(categoryName); // remove layers (along with the category)
}

The code works, what I ask if it could be done better. I mean, are the layers disposed properly this way or should I do something explicitly?

Thanx in advance

share|improve this question
    
Do you just want to remove layers from group layer? For that, I think, your code is perferct –  Emi Jan 17 '13 at 8:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.