An implementation (here) of a COM filter class adds dependencies on MarshalByRefObject
class and IDisposable
interface, as follows:
class MessageFilter : MarshalByRefObject, IDisposable, IMessageFilter
The MSDN implementation of the same does not use these:
class MessageFilter : IOleMessageFilter
I have tried both implementations, and they both work. Why does the MSDN implementation not require the dependencies? Are they possibly pulled in due to attributes used by the IOleMessageFilter
interface involved? The attributes used are:
[ComImport()]
[Guid("00000016-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
But these are used by both implementations, so I am confused. Both implementations also specify [DllImport("Ole32.dll")]
, but the MSDN implementation does not include an accompanying [PreserveSig]
.