As already mentioned, C # does not support type providers, and there is no easy way to emulate them (as Gustavo mentioned, you can use the generated type providers through the small F # library, but XML, JSON, CSV and others are not kind.)
I think using the F # library, which is best suited for processing.
A more complex alternative would be to write code that allows you to define types for modeling an XML file in C #, and then automatically reads the file into these classes. I don't think anything like this exists, but I wrote a similar thing in F # (before type providers), so you can see a snippet for inspiration . The usage looks like this:
// Modelling RSS feeds - the following types define the structure of the // expected XML file. The StructuralXml parser can automatically read // XML file into a structure formed by these types. type Title = Title of string type Link = Link of string type Description = Description of string type Item = Item of Title * Link * Description type Channel = Channel of Title * Link * Description * list<Item> type Rss = Rss of Channel // Load data and specify that names in XML are all lowercase let url = "http://feeds.guardian.co.uk/theguardian/world/rss" let doc : StructuralXml<Rss> = StructuralXml.Load(url, LowerCase = true) // Match the data against a type modeling the RSS feed structure let (Rss(channel)) = doc.Root let (Channel(_, _, _, items)) = channel for (Item(Title t, _, _)) in items do printfn "%s" t
source share