I am in the middle of writing a new article for codeproject which uses Amazon Web Services (AWS) to obtain a array of Details objects back from a call to the web service proxy. I want to then use some of this data retrieved for an individual Details object, to display on a WPF Flow Document. I had a think about this and thought man, I really dont want to write some nasty loop. LINQ immediately came to mind, unfortunatley the Amazon web service Details object is not something that can be queried using LINQ. As its a single class with lots of properties, and doesnt implement IEnumerable which LINQ needs. This is the case as Amazon Web Services (ASMX) has to cater for all languages, so a simply array is returned. Not cool for LINQability. Mmmm Grrr.
So I had another think about this, and thought, why not just get all the properties that I would like the values of using reflection, and then use LINQ over the resulting array of PropertyInfo (PropertyInfo) which is of course LINQ query ready, as an array of PropertyInfo implements IEnumerable.
The resultanat code is very simple, but allows me to query the single Detail (Amazon Web Service implementation)
Lets see that now shall we
And that is all there was to it