I am triyng to access the FullName property of IDataset, but FullName is always null (incidentsDataset.FullName below)
Here is the code I'm using:
IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument; IMap map = mxdoc.FocusMap; IEnumLayer enumLayer = map.Layers; ILayer layer = enumLayer.Next(); IFeatureLayer2 incidentsFLayer = null; while (layer != null) { if (layer.Name == "Incidents" && layer is IFeatureLayer2) { incidentsFLayer = layer as IFeatureLayer2; } layer = enumLayer.Next(); } IFeatureClass incidentsFC = incidentsFLayer.FeatureClass as IFeatureClass; IDataset incidentsDataset = incidentsFC as IDataset; IFeatureClassName incidentsFCName = incidentsDataset.FullName as IFeatureClassName;
Thanks.
Hi, do you mean the IName object returned by incidentsDataset.FullName is null, or its NameString is empty? I tested your code snippet, and was able to get a valid IName object as well as a valid IFeatureClassName after casting. Though the NameString is empty (which is a known issue http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//00420000014z000000 ), we can use the IName.Open method to open the feature class. if you would like to get the name string, you may consider using IDataset.Name property instead.