2

How to use System.Dynamic.DynamicObject in VB.NET 10.0 ?

I can create class that inherits from DynamicObject, but cannot actually use it.

2 Answers 2

1

With VB, you have to turn Option Strict OFF on the class file that you want to consume the DynamicObject implementation. Doing this does mean that you lose the type safety that comes with Option Strict On. In addition, Dynamic opens you up to no longer relying on the compiler to check your method names for you.

I'm writing a series on creating a Dynamic CSV Enumerable type in VB at http://www.thinqlinq.com/Post.aspx/Title/LINQ-to-CSV-using-DynamicObject and can assure you that it does work in VB.

Jim Wooley

Sign up to request clarification or add additional context in comments.

Comments

0

See this page

Subclasses can override the various binder methods (GetMember, SetMember, Call, etc.) to provide custom behavior that will be invoked at runtime. If a method is not overridden then the DynamicObject does not directly support that behavior and the call site will determine how the binding should be performed.

1 Comment

Of course I read this. My point is, I cannot syntactically access dynamic properties and methods the same way I can do in C#. VB.NET just doesn't compile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.