Where does IDispatchEx exists?

≯℡__Kan透↙ 提交于 2019-12-10 19:21:33

问题


Can't find the library which contains IDispatchEx interface. I want to implement this interface, but can't find it. Does anyone knows where it is?

Thanks, Paul.


回答1:


If you want to write a managed class that implements the IDispatchEx interface you will first need to define this interface because it does not exist in .NET. Here's a link to its definition. IMHO implementing this interface won't be a trivial task.




回答2:


What exactly do you want to do? Is this for use inside C#? Or from outside (COM)?

If you just want browser support, then perhaps host in WebBrowser and set the ObjectForScripting.

You can sort of add methods to a type in C# 3.0 with extension methods:

public static void Bar(this Foo foo, int someArg) {...}
....
Foo foo = ...
foo.Bar(123);

But this is still static-typed. C# 4.0 introduces dynamic for true dynamic objects inside the CLR/DLR, but you'd implement IDynamicObject. And it isn't trivial.



来源:https://stackoverflow.com/questions/647549/where-does-idispatchex-exists

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!