NET.enableAutoRelease
解锁表示运行时可调用包装器(COM 包装器)的 .NET 对象
说明
当对象超出范围时,NET.enableAutoRelease(
释放 COM 包装器。obj
)
仅当使用 NET.disableAutoRelease
锁定了对象时才需要调用该函数
示例
释放 COM 包装器对象
以下伪代码显示如何调用返回 COM 对象的函数(NET.disableAutoRelease
中所述的 GetComApp.m
)。NetDocTest.MyClass
类型的对象 mainObj
包含一个 MyApp
属性。调用 GetComApp
获取 COM 对象,并使用其 readData
方法。
mainObj = NetDocTest.MyClass; GetComApp(mainObj); app = mainObj.MyApp; app.readData('hello'); % Unlock the COM object NET.enableAutoRelease(mainObj.MyApp);
输入参数
obj
— 表示 COM 包装器的 .NET 对象
COM 包装器类
表示 COM 包装器的 .NET 对象,指定为 COM 包装器类对象。
示例: ComNamespace.ComClass
版本历史记录
在 R2010b 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)