判断Workspace的存在
IWorkspaceFactory.ContainsWorkspace
另外,附上帮助的例子:
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); }