C# Dynamic Lookup - a suggestion.

29 01 2008

Paul Stovell passed around a link to this blog post by Charlie Calvert and Mads Torgersen about the dynamic lookup feature in a future version of C#. Personally I like the feature and I can see myself using it in a few specific circumstances.

Reading through it, I’ve got two suggestions. We need to ability to use a string variable or literal to name the member that we are interacting with. This would be incredibly helpful for things like dynamic sorting scenarios in web applications.

The second suggestion is turning the dynamic lookup into a kind of duck typing facility where-by you can continue to use the object outside the dynamic scope provided you only access the members that you had accessed inside the dynamic scope - although I am not sure if that is terribly useful, just a thought.