判断Workspace的存在

IWorkspaceFactory.ContainsWorkspace
另外,附上帮助的例子:

//IWorkspaceFactory ContainsWorkspace Example
//e.g., nameOfFile = "canada.mdb" //Personal Geodatabase   
//      nameOfFile = "canada.gdb" //File Geodatabase   
public Boolean IWorkspaceFactory_ContainsWorkspace_Example(string nameOfFile)   
{      
    //use with AccessWorkspaceFactory        
    IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass();   
    //for FileGDB use ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass();        
    ESRI.ArcGIS.esriSystem.IFileNames fileNames = new ESRI.ArcGIS.esriSystem.FileNamesClass();   
    fileNames.Add(nameOfFile);        
    return workspaceFactory.ContainsWorkspace("E:\\data\\english\\canada\\", fileNames);   
}
 

你可能感兴趣的:(workspace)