Mike,
In addition to the others comments. Are you referring to
System.Runtime.InteropServices.Expando.IExpando?
To the best of my knowledge it is there to support 'Dynamic Scripting'
languages such as JScript.NET. It is also used with COM Interop to enable
the IDispatchEx interface (again 'dynamic scripting' languages).
If you look at the Microsoft.JScript assembly there are a number of classes
that implement IExpando.
Also JScript.NET has an expando keyword that 'declares that instances of a
class support expando properties or that a method is an expando object
constructor'.
What specifically are you trying to accomplish?
Remember that VB.NET is a compiled language, in order to use 'dynamic
properties' you will need to use late binding. I hope you realize that late
binding is not always such a good idea.
What I normally do to implement 'dynamic properties' is to have a default
indexer on my class that accepts a string as the key. This enables the !
operator, so the property looks very much dynamic.
Public Class Expando
Private readonly m_properties As New HashTable
Default Public Property Item(key As String) as Object
Get
return m_properties(key)
End Get
Set(value As Object)
m_properties(key) = value
End Set
End Property
End Class
Then when I need to use it:
dim expando as New Expando
expando!Name = "Mike "
expando("Name") = "Mike "
expando.Item("Name") = "Mike "
As you notice all three syntaxes work.
Of course you need to make the property Object to support any type, which
means you need to cast the property when you take it out, if you are using
Option Strict On, you are using Option Strict?
Hope this helps
Jay