Did anyone wrote a function to get a layer from map service (dynamic or tiled) by its name not by its ID ?
I am not sure what you call the layer name. You should be able to get the layer you need by looping on the Map layers. For example to get the layer having a specified MapName, you can get it by code like: var myLayer = myMap.Layers.OfType<ArcGISDynamicMapServiceLayer>().FirstOrDefault(l => l.MapName == "SpecifiedMapName");