This document is archived and information here might be outdated. Recommended version. |
Get the full path and filename of a layer.
///<summary>Get the full path and filename of a layer.</summary> /// ///<param name="layer">An ILayer interface.</param> /// ///<returns>A System.String that is the full path and filename for a layer</returns> /// ///<remarks></remarks> public System.String GetPathForALayer(ESRI.ArcGIS.Carto.ILayer layer) { if(layer == null || !(layer is ESRI.ArcGIS.Geodatabase.IDataset)) { return null; } ESRI.ArcGIS.Geodatabase.IDataset dataset=(ESRI.ArcGIS.Geodatabase.IDataset)(layer); // Explicit Cast return (dataset.Workspace.PathName + "\\" + dataset.Name); }
'''<summary>Get the full path and filename of a layer.</summary> ''' '''<param name="layer">An ILayer interface.</param> ''' '''<returns>A System.String that is the full path and filename for a layer</returns> ''' '''<remarks></remarks> Public Function GetPathForALayer(ByVal layer As ESRI.ArcGIS.Carto.ILayer) As System.String If layer Is Nothing OrElse Not (TypeOf layer Is ESRI.ArcGIS.Geodatabase.IDataset) Then Return Nothing End If Dim dataset As ESRI.ArcGIS.Geodatabase.IDataset=CType(layer, ESRI.ArcGIS.Geodatabase.IDataset) ' Explicit Cast Return (dataset.Workspace.PathName & "\" & dataset.Name) End Function