In C#, how do I get the path of a layer file? I can get the datasource and name of the layer but I need to get the path to the .lyr file. I want to record the path so my extension can copy and load the .lyr file later.
This gives the path to the datasource (.mdb geodatabase in my case) that the .lyr file references:
var dataset = (IDataset) map.Layer; var name = dataset.Workspace.PathName + "\\" + dataset.Name
Using that info plus the FeatureClass name I can open the layer and get the layer's polygons on the map but it is not the same as opening the .lyr file.