Helo!
Is this possible to use string value of one node which tells what type of field is presented in another node using LINQ to XML?
For example:
<node> <name>nodeName</name> <type>string</type> </node> <node> <name>0</name> <type>bool</type> </node> <node> <name>42</name> <type>int</type> </node>
Thanks in advance
Well, you won’t get a nice statically typed API given that the type information is only known at execution time – but you could easily write an extension method on XElement which looks for the appropriate subelements and returns
System.Object. For instance (untested):It’s not how I’d design a data format, but if it’s being thrust upon you…