在各种WorkSpace中判断要打开的文件(如:栅格,要素)是否存在

用IWorkspace2.NameExists可以判断工作空间是否存在指定名称和类型的数据集..

 

引用MSDN的例子,获得工作空间的文件名字,历遍:

//IWorkspace DatasetNames Example
    public void IWorkspace_DatasetNames_Example(IWorkspace workspace)    
{        
//This function asks the workspace for its feature dataset names.        
//The names are returned as an enumeration which is cycled through and the         
//name of each dataset is printed.        
IEnumDatasetName enumDatasetName = workspace.get_DatasetNames(esriDatasetType.esriDTFeatureDataset);
IDatasetName datasetName = enumDatasetName.Next();
 while (datasetName != null)        
{            
    Console.WriteLine(datasetName.Name);            
    datasetName = enumDatasetName.Next();        
}    
}

 
转载自:https://blog.csdn.net/iteye_4943/article/details/81832220

You may also like...