The runtime creates exactly one rcw for each com object , regardless of the number of references that exist on that object 无论一个com对象存在多少个引用,运行库只为每个com对象创建一个rcw 。
Rcw from the metadata in an interop assembly . unlike other assemblies , interop assemblies are generated by importing type libraries 与其他程序集不同的是, interop程序集是通过导入类型库生成的。
Assuming that you have an idl file or type library file , decide which classes and interfaces you want to include in the custom rcw 假定已有idl文件或类型库文件,决定要将哪些类和接口包含在自定义rcw中。
Having rcw source code that contains a portion of the types in a large type library can eliminate the need to deploy unnecessary types 具有包含大型类型库中的部分类型的rcw源代码可以消除部署不必要的类型的需要。
Rcw are delivered to the underlying com component in the current apartment or context instead of the one in which they exist ( rcw )发出的调用发送到当前单元或上下文中的基础com组件,而不是发送到调用所在的com组件。
Although the rcw appears to be an ordinary object to . net clients , its primary function is to marshal calls between a . net client and a com object 虽然rcw在. net客户端看来是普通的对象,但它的主要功能是封送在. net客户端和com对象之间传递的调用。
Each rcw maintains a cache of interface pointers on the com object it wraps and releases its reference on the com object when the rcw is no longer needed 每个rcw都会在它所包装的com对象上维护一个接口指针缓存,并且在不再需要rcw时释放它对该com对象的引用。
In most cases , the standard rcw or ccw generated by the runtime provides adequate marshaling for calls that cross the boundary between com and the . net framework 大多数情况下,运行库所生成的标准rcw或ccw将为跨越com和. net framework之间边界的调用提供充分的封送处理。
Although the import process generally produces accurate interop assemblies , there are cases when you can or must modify the interop assembly to produce a custom rcw 虽然导入过程通常会产生精确的interop程序集,但在有些情况下,可以(或必须)修改interop程序集来产生自定义rcw 。
If you create an rcw in one application domain or apartment , and then pass a reference to another application domain or apartment , a proxy to the first object will be used 如果在一个应用程序域或单元中创建rcw ,然后将引用传递至另外一个应用程序域或单元,则会使用第一个对象的代理。