Thumbnail View Resource
Source (Josh Smith on WPF), posted 2010-05-23

Added By

Avatar BillHenn on 2010-05-30

  • 5306 total views
Shows how to use C# 4.0's DynamicObject to wrap access to properties and in this example ensure that properties on the wrapped object are called on the main UI thread.
"One of the most interesting (and potentially dangerous) new features in C# 4.0 is support for the dynamic type. It allows certain pieces of your code to bypass the normal compile-time type checking features that we have grown to know and love. You can use a dynamic object however you want to, and the C# compiler will ignore the members you use on it. At runtime, if the methods/properties/etc. your code tries to use are not actually present on the object, an exception is thrown. If they do exist, they will be linked to and invoked dynamically. This technique is called dynamic dispatch. What you lose in safety, you gain in flexibility."
Full Link

About Josh Smith on WPF

The personal blog of Josh Smith, who is one of the top WPF evangelists on the web. He is a Microsoft MVP (Most Valuable Professional) and a member of the well-known WPF Disciples group. Josh has written a lot of useful articles for Code Project and has contributed to several helpful utilities for WPF developers. He has done a lot of work with design patterns and has a book out on the MVVM pattern.

The WPFpedia resource guide has 48 total links to this site.


There aren't any comments yet for this resource. Be the first to add one!

Add a Comment

Please log in to post comments.



Thumbnail Screenshots by Thumbshots