zoukankan      html  css  js  c++  java
  • Release COM Objects in AE

    When you codeing in Arc Engine, you need to consider the objects that you created, and if you leave so many unmanaged objects in the memory, and then you will find some wired activities.

    You may need:

      System.Runtime.InteropServices.Marshal.ReleaseComObject(pWorkFactory);

    Or, you may use the ComComReleaser in the ArcGIS assembly ESRI.ArcGIS.ADF.Connection.Local:

      ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pWorkFactory);

    You must release the cursors with used to reach the values, and the workspaces that you used to access data.

    When you get a cursor form a shpfile, then you will find a file like this in you disk:

      

    And if you use the WorkspaceEdit like that:

      IWorkspace workspace = ((IDataset)pFeatureClass_para).Workspace;
      IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;

      bool startEdit = workspaceEdit.IsBeingEdited();
      if (!startEdit)
      {
        workspaceEdit.StartEditing(false);
      }
      workspaceEdit.StartEditOperation();

    Then you will get a file like this:

      

    Then you need stop edit the work space, like this:

      workspaceEdit.StopEditOperation();
      startEdit = workspaceEdit.IsBeingEdited();
      while (startEdit)
      {
        workspaceEdit.StopEditing(true);
        startEdit = workspaceEdit.IsBeingEdited();
      }

  • 相关阅读:
    A1132 Cut Integer (20分)
    A1131 Subway Map (30分)
    A1130 Infix Expression (25分)
    A1129 Recommendation System (25分)
    A1128 N Queens Puzzle (20分)
    arm指令集
    韦东山视频地址
    汇编知识
    emacs 使用教程
    ip
  • 原文地址:https://www.cnblogs.com/henyihanwobushi/p/2983083.html
Copyright © 2011-2022 走看看