ArcEngine临时数据存储 创建内存工作空间
参考网址,这里
工作中有时候需要使用临时数据,以前都是创建一个默认的shapefile或者gdb,今天发现esri官方帮助文档给出了一个方法,可以创建内存工作空间,代码如下:
public static IWorkspace CreateInMemoryWorkspace() { // Create an in-memory workspace factory. Type factoryType = Type.GetTypeFromProgID( "esriDataSourcesGDB.InMemoryWorkspaceFactory"); IWorkspaceFactory workspaceFactory = (IWorkspaceFactory) Activator.CreateInstance(factoryType); // Create an in-memory workspace. IWorkspaceName workspaceName = workspaceFactory.Create("", "MyWorkspace", null, 0); // Cast for IName and open a reference to the in-memory workspace through the name object. IName name = (IName)workspaceName; IWorkspace workspace = (IWorkspace)name.Open(); return workspace; }