3

I have .NET Assembly exposed to COM, and I want to create a custom QueryInterface, otherwise my Class will have to implement a lot of interfaces.

Currently my implementation is like this

[ComVisible(true]
[ProgId("SomeLib.SomeClass")]
[Guid("516E4529-38F1-44EE-B340-ABFA498DC922")]
public class MyClass : Interface1, Interface2......, etc

I want my class not to implement those interfaces, but when QueryInterface is called to return an object that implements the requested interface. I know this feature exists for .NET framework 4.0 (see ICustomQueryInterface ) Unfortunately I need to do it in 3.5

starblue
  • 55,348
  • 14
  • 97
  • 151
Pablo Retyk
  • 5,690
  • 6
  • 44
  • 59

1 Answers1

1

Starting from .NET 4.0, you can do this. You can use ICustomQueryInterface for this. See also a usage sample and another sample.

Gragus
  • 94
  • 1
  • 2