In using arcpy, I have found that there are just a few lines of code needed to get a list of layers in a LYR file if more than one layer exist. How can I accomplish this same feat using ArcObjects in C#? I know that ILayerFile is the way to start this off and I can open a specific layer file using ILayerFile.Open() but how can I get back a list of layers in this layer file if more than one exist?
If the QI succeded, check
You can then access a sublayer by its index (probably using a for loop) using the
If you think the layer file might have multiple nested group layers, you would want to write a recursive function to loop through each sublayer and recurse if it is also a composite layer or do something else with it if not.