摘要:
.net中使用com对象,使用后必须通过如下代码释放:
比如定义的solayer类型的变量objlayer
System.Runtime.InteropServices.Marshal.ReleaseComObject(objlayer);
objlayer=null;
如果接口返回值也是一个com对象的话,也必须定义一个变量来接收,然后释放:
比如:
object handle;
handle=superworkspace1.CtlHandle();
supermap1.Connect(handle);
System.Runtime.InteropServices.Marshal.ReleaseComObject(handle);
handle=null; 阅读全文