Search code examples
.netvb.netdynamicpropertiesintrospection

Constructing Dynamic Properties at Runtime in VB .NET


Is there a way to dynamically create properties at runtime in VB .NET using introspection?

e.g. Suppose I had a class

Public Class Foo
   Public Property Bar() As String
       get 
           ...
       end get
      set(ByVal value As String)
          ...
      end set
End Class

Is there a way to create property Bar at runtime?

Thanks!


Solution

  • The answer is Reflection.Emit. Not a lot of fun to code, but does what you want.