If I write a code that calls COM component from .NET, is it开发者_StackOverflow社区 an example of Adapter pattern?
The Runtime Callable Wrapper (RCW) functionality in .NET is more an application of the Proxy pattern, because the .NET class mirrors the interface of the underlying COM component.
Quote from Sourcemaking:
Adapter provides a different interface to its subject. Proxy provides the same interface.
Related resources:
- Runtime Callable Wrapper (RCW)
- Proxy Design Pattern
- Adapter Design Pattern
The pinvoke dll generated by Visual studio is already an adapter.
精彩评论