deCast - Dynamic Xml with C# 4.0
- Posted: Jan 26, 2009 at 3:32 AM
- 15,054 Views
- 4 Comments
Download
How do I download the videos?
- To download, right click the file type you would like and pick “Save target as…” or “Save link as…”
Why should I download videos from Channel9?
- It's an easy way to save the videos you like locally.
- You can save the videos in order to watch them offline.
- If all you want is to hear the audio, you can download the MP3!
Which version should I choose?
- If you want to view the video on your PC, Xbox or Media Center, download the High Quality WMV file (this is the highest quality version we have available).
- If you'd like a lower bitrate version, to reduce the download time or cost, then choose the Medium Quality WMV file.
- If you have a Zune, WP7, iPhone, iPad, or iPod device, choose the low or medium MP4 file.
- If you just want to hear the audio of the video, choose the MP3 file.
Right click “Save as…”
- High Quality WMV (PC, Xbox, MCE)
- MP3 (Audio only)
- MP4 (iPod, Zune HD)
- Mid Quality WMV (Lo-band, Mobile)
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
This is pretty nice but broken. There's too much magic going on. The XML GI syntax (and still more the ns'd GI syntax) does not match up with C# method name syntax. In particular C# method names are far more restricted than XML (namespace) names, they cannot express them. Now adding magic names such as Nodes, Parent, etc. will only compound the problem. What happens if a document actually happens to have an element called Parent or Nodes? So based on a quick review, this approach does not appear sound, as much as I love syntactic sugar.
Now the idea to abstract over attribute and element names is quite sweet. I like the idea and this is also the approach that RDF/XML takes. It just needs to be an explicit abstraction taken by the client not built into the API as a default, thus projecting that assumption onto all existing XML.
As a way to illustrate how dynamic is useful this is not so bad - except it, in my oppinion, teaches an unsound practice for dealing with XML; at least it is not general-purpose. One has to know a priori that such and such name collisions (Parent, Nodes?) will not occur (there goes extensibility) and that cannot express such and such names (XML name syntax, including names in popular XML dialects such as XSLT, where you can have: xslt:value-of).
Any chance you could post the sample implementation of this code please?
Thanks - this look good.
The screencast goes over your fun little XML DSL but doesn't ACTUALLY talk about how to take advantage of any of C# 4.0's dynamic objects.
Very neat, but now I have to search online for documentation on DynamicObject and methods like GetMember, assuming those are part of the CLR or DLR and not something you wrote.
Could you please post the code from the episode so people can take a look at the actual code to figure out how to take advantage of these new features?
DynamicObject reference: http://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject.aspx
A blog post that shows example implementations of TryInvokeMember, TryGetMember, TrySetMember, and more: http://weblogs.asp.net/dixin/archive/2010/06/08/a-todynamic-extension-method-for-fluent-reflection.aspx
Remove this comment
Remove this thread
close