They are extremely useful. They can be used to simplify COM interop, to provide a much nicer syntax for Reflection, to enable duck typing, and (of course) to do actual dynamic dispatch.
views:
247answers:
5
+1
A:
Stephen Cleary
2010-06-02 17:31:34
A:
This very popular question provides a number of uses for dynamic types, which would probably be helpful here.
And this question also provides some help.
DOK
2010-06-02 17:32:26
+2
A:
As long as
- the types are defined at compile time
- the types held in a dynamic variable cannot change
- errors are caught at compile-time, and not run-time
i'm okay with them.
Otherwise it's untyped variants, and IDispatch interfaces, all over again.
Exempli Gratia
dynamic c = new ADOdb.Connection();
c.Excute("SELECT * FROM Users");
And the error isn't caught when i compile. :(
Ian Boyd
2010-06-02 17:34:01
A:
I find them very useful. Coming from a C/C++ background, it was weird at first, but now all my variables are dynamic, all I have to worry about is making sure objects have the right interface, not the right type.
It takes a lot of headache out of programming and getting parameters to fit into function calls.
Jason Spitkoski
2010-06-02 17:36:56
NOOOOOooooooo:(
Anthony Pegram
2010-06-02 17:42:35