ArcGIS Server笔记之ManageLifetime
ManageLifetime:从字面意思我们理解为“生命周期管理”。生命周期应该有一个范围,也就是一个作用域吧。在这个作用域范围生命存在,超出这个范围生命终止(个人理解)。
Use the ManageLifetime method to add your COM object to the set of objects that will be explicitly released when the WebObject is disposed.
当WebObject析构时,使用ManageLifetime方法管理的一系列创建的COM对象将被显示释放。
When you scope the use of WebObject within a using block, any object (including your cursor) that you have added to the WebObject using the ManageLifetime method will be explicitly released at the end of the using block.
当你使用Using语句块管理WebObject对象时,WebObject对象的ManageLifetime方法管理的任何COM对象在Using语句块结束后都将被显示释放。

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

备注 :
1、using 语句:
在 using 语句中创建一个实例,确保退出 using 语句时在对象上调用 Dispose。当到达 using 语句的末尾,或者如果在语句结束之前引发异常并且控制离开语句块,都可以退出 using 语句。
2、WebObject.ManageLifetime 方法 [C#]
public void ManageLifetime(object o);
参数:o Com对象
3、WebObject对象:
命名空间: ESRI.ArcGIS.Server.WebControls
程序集: ESRI.ArcGIS.Server.WebControls (in ESRI.ArcGIS.Server.WebControls.dll)