What is IExpando and where is it used?

冷暖自知 提交于 2019-12-23 12:43:55

问题


I was browsing the types in mscorlib using reflector (like you do...) and came across the IExpando interface, in the System.Runtime.InteropServices.Expando namespace.

I did a search in reflector and even checked out MSDN, it seems that no types in mscorlib implement this interface. There are also no code examples on MSDN.

Has anyone implemented this interface in their own code?

Does anyone know what it is used for exactly?

Thanks


回答1:


Yeah, it is a bit out-of-place today. It is the managed declaration of the COM interface type. Also present, note ComTypes.IExpando and InteropServices.UCOMIExpando. Core interfaces for scripting runtimes to implement property bags. In particular for Javascript, check this thread.

Microsoft had high hopes for JScript, it was a primary language supported along-side C#, VB.NET and Managed C++. That didn't work out.

Forgotten, but not quite dead. The ExpandoObject class is back in .NET 4.0




回答2:


It is the .NET version of COM's IDispatchEx capability of dynamially adding members.

See http://blogs.msdn.com/b/shrib/archive/2007/09/04/ireflect-and-idispatch.aspx



来源:https://stackoverflow.com/questions/3414162/what-is-iexpando-and-where-is-it-used

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