Is there a reason why you don't want to set the ID of the layer? You can get the layer based on ID or index.
Map.Layers[LayerID] or Map.Layers[index]
One option is you to include an ArcGISDynamicMapService in your map. Then, the 'Layers' property of this ArcGISDynamicMapService is giving you an array with the layer IDs, names, ...
If you don't want to include such a layer in your map, you can request yourself the mapserver endpoint and deserialize the result. Example of mapserver url : http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Age/MapServer?f=pjson
Oh you don't mean x:Name?
If you mean name defined in the service, you can probably keep them in a dictionary (if you know that names will be unique), with URL as the value. You can add to the dictionary as each layer is initialized.
For the main layer, you can use MapName.
http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.ArcGISDyna...
For the sub layers, you can use LayerInfo.Name and append the sub layer ID to the main layer's URL.
http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.LayerInfo~...
For FeatureLayer, it's similar.
http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureSer...
These information are available after the layer has initialized.
One option is you to include an ArcGISDynamicMapService in your map. Then, the 'Layers' property of this ArcGISDynamicMapService is giving you an array with the layer IDs, names, ...
If you don't want to include such a layer in your map, you can request yourself the mapserver endpoint and deserialize the result. Example of mapserver url : http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Age/MapServer?f=pjson
I do have ArcGISDynamicMapService in my map, but at this point, I have not run the query to get the map layers yet. My code is run after the wpf map page is loaded (it is inside the xx_loaded method). Map.Layers will be null. Hope I'm clear now.
I don't understand why Map.layers is null if you do have an ArcGISDynamicMapService inside it. You should at least have this layer in Map.Layers?
That being said, this will not help you because at this moment the layer is not yet initialized so the sublayers are not yet known.
You could put your code in the 'Initialized' event of the layer. At this moment, the LayerInfo array will be initialized.