private FeatureLayer GetFeatureLayerByName(Map map, string layerName) {
var featureLayers = map.GetLayersAsFlattenedList().OfType<FeatureLayer>();
foreach (var layer in featureLayers) {
if (layer.Name.Equals(layerName, StringComparison.CurrentCultureIgnoreCase))
return layer;
}
return null;
}
原文:https://www.cnblogs.com/gisoracle/p/12622833.html