如何通过COM互操作公开用Prism编写的类?例如,给定以下接口:
TYPE IFoo = public interface property bar: string; read; end; FooImpl = class( IFoo ) private function GetBar : string; public property bar: string; read GetBar; end;
在本例中,假设IFoo是通过TLBIMP导入并链接到项目的。
使用ComVisible属性使程序集和/或类公开。当使用tlbexp.exe(.NET SDK的一部分)时,您将获得作为COM接口的接口,以及作为IFoo的辅助类的类。或者,您可以使用Guid属性为接口和(co)类设置特定的Guid。