5

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

fletcher
  • 13,380
  • 9
  • 52
  • 69
  • iirc, it's something to do with dynamic types - but I could be totally wrong. Just looked at the link and I believe it allows you to add dynamic properties to the dynamic type. Someone else will be along with a proper answer shortly I'm sure. – cristobalito Aug 05 '10 at 11:25
  • Check out `Microsoft.JScript.JSObject` in the `Microsoft.JScript` assembly - there are various implementations of the IExpando interface. – Jaroslav Jandek Aug 05 '10 at 11:41
  • 1
    @Joan: it's Texan, I think. Look up "expandomatic". – Hans Passant Aug 08 '10 at 10:20

2 Answers2

6

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

Community
  • 1
  • 1
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
3

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

Richard
  • 106,783
  • 21
  • 203
  • 265