var allFeatLayers = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().ToList(); 
foreach (var layer in allFeatLayers)
{
// Do something with layer
}