Why does accessing a COM object from .NET, without going through the Interop class, sometimes work?

后端 未结 3 2251
面向向阳花
面向向阳花 2021-02-19 23:06

When you interface a COM object from .NET code, VS creates an interop DLL, with interop classes.

Example:

You have a foo.dll the implements a COM library Foo, th

3条回答
  •  深忆病人
    2021-02-19 23:37

    The Bar() constructor in principle should be returning the interface explicitly instead of the class object. I can't quite figure out how .NET is supporting the construction of an interface!?

    In any case, you can click on the Bar() constructor and hit Shift-F12. This will show you anywhere else in the code where that constructor is being used. I can't think of a way to prevent a user from calling this constructor inadvertently.

提交回复
热议问题