Home  /  Questions  /  Question



128   96.7
Dec 14, 2010


Practical use of the "dynamic" C# keyword in Design Patterns

The dynamic keyword is a recent addition to the C# language.  I have a gut feel that one or more of the GOF and/or MVC/MVP/MVVM patterns could benefit from its use.

Has anyone found a great use of dynamic in any of their own Design Pattern implementations?
(I am looking for this nice little 'gem' :-) )

Thanks.



1,128   99.9
Dec 15, 2010
Not for a pattern but here's a usage for the dynamic keyword http://kozmic.pl/2010/12/15/c-dynamic-and-generics-dispatch/


1,364   100.0
Jan 06, 2011
I haven't used it yet, but came across this implementation of "VISITOR" design pattern using "dynamic" in c#.  In fact, this is one of the cool language features that may have many applications which may not have been explored yet because of the static nature of c#.  But dynamic will change that.  Once caveat would be dynamic has a cost and its proper usage should always be evaluated.

http://code.logos.com/blog/2010/03/the_visitor_pattern_and_dynamic_in_c_4.html

Hope you find this useful.