public IReadOnlyList<Layer> GetLayersAsFlattenedList()
Public Function GetLayersAsFlattenedList() As IReadOnlyList(Of Layer)
Return Value
A read only list of layers
public IReadOnlyList<Layer> GetLayersAsFlattenedList()
Public Function GetLayersAsFlattenedList() As IReadOnlyList(Of Layer)
List<FeatureLayer> featureLayerList = aMap.GetLayersAsFlattenedList().OfType<FeatureLayer>().ToList();
//Get an existing Layer. This layer has a symbol you want to use in a new layer. var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>() .Where(l => l.ShapeType == esriGeometryType.esriGeometryPoint).FirstOrDefault();
//Finds layers by name and returns a read only list of Layers IReadOnlyList<Layer> layers = aMap.FindLayers("cities", true); //Finds a layer using a URI. //The Layer URI you pass in helps you search for a specific layer in a map var lyrFindLayer = MapView.Active.Map.FindLayer("CIMPATH=map/u_s__states__generalized_.xml"); //This returns a collection of layers of the "name" specified. You can use any Linq expression to query the collection. var lyrExists = MapView.Active.Map.GetLayersAsFlattenedList() .OfType<FeatureLayer>().Any(f => f.Name == "U.S. States (Generalized)");
Map map = MapView.Active.Map; IEnumerable<Layer> matches = map.GetLayersAsFlattenedList().Where(l => l.Name.IndexOf(partialName, StringComparison.CurrentCultureIgnoreCase) >= 0);
Target Platforms: Windows 11, Windows 10, Windows 8.1