Find property and its value on a deserialized xml RRS feed

  • Question

  • Hi,

    My xml has a property type "Any", but the estructure of "Any" it's not defined in the class, once I deserialize the xml I can see the elements and properties of the whole object and also "Any" but just in debug time, I need to search for a value within "Any" section, something like:  Find "propertyname" and if exists return value , ¿maybe linq?

    Any ideas?


    Thursday, March 29, 2018 11:08 PM

All replies

  • What is estructure ?

    Might be a good idea to indicate how you are accessing the xml (code sample and use the code button)

    If whatever method you are trying now does not work does not mean LINQ will so start with more details and visuals please.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, March 29, 2018 11:14 PM
  • Thanks Karen, it's a bit complex to reproduce it in here, but let's say my object class (deserialized xml) looks like this when debugging:


    In design mode I just can get until Company.Department.Employee.Any and I can't see further, this is because when deserializing I depend on a XSD class.

    So how do I get "John" in run time using linq?


    Friday, March 30, 2018 12:47 AM
  • Are you having a problem accessing the value in the XML or in the class objects that you created?  When you say "deserialized xml", what performed the deserialization? Is this your own parsing routine or some other code which generates the object model you displayed?

    If the problem has to do with parsing the XML, please provide a short example of the actual XML and I'm sure we can help you parse it out.

    If the problem has to do with accessing the object model created from an XML document, please tell us/show us how that object model is being created.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, March 30, 2018 1:21 PM