1

With .NET ArcObjects, I discovered that I could use an InMemoryWorkspaceFactory for my temporary feature classes. It is great, but I would like to know if there is a way to open an existing InMemory workspace. If mean, if I create "MyWorkspace" in memory with the following code, is there a way to open it elsewhere without keeping the variable pFeatureWorkspace global?

        Dim t As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.InMemoryWorkspaceFactory")
        pWorkspaceFactory = Activator.CreateInstance(t)
        aWorksName = pWorkspaceFactory.Create(Nothing, "MyWorkspace", Nothing, 0)
        pFeatureWorkspace = CType(aWorksName, WorkspaceName).Open()

closed as primarily opinion-based by Vince, Mapperz Nov 18 '16 at 15:25

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • This problem screams for a static singleton object pattern. – Vince Nov 16 '16 at 23:57
  • The workspace factory is a singleton, but the feature workspace is not (at least is it not in the ArcObjects help). – Math Nov 17 '16 at 13:31
  • No, I'm saying that you should use the singleton object design pattern to manifest access to the in_memory workspace, not a global. – Vince Nov 18 '16 at 0:09
  • Ok, that way, I will use a global variable anyway. – Math Nov 18 '16 at 13:31

Browse other questions tagged or ask your own question.