Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 35653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:16:11+00:00 2026-05-10T14:16:11+00:00

I have an object graph serialized to xaml. A rough sample of what it

  • 0

I have an object graph serialized to xaml. A rough sample of what it looks like is:

<MyObject xmlns.... >     <MyObject.TheCollection>         <PolymorphicObjectOne .../>         <HiImPolymorphic ... />     </MyObject.TheCollection> </MyObject> 

I want to use Linq to XML in order to extract the serialized objects within the TheCollection.

Note: MyObject may be named differently at runtime; I’m interested in any object that implements the same interface, which has a public collection called TheCollection that contains types of IPolymorphicLol.

The only things I know at runtime are the depth at which I will find the collection and that the collection element is named “*.TheCollection`. Everything else will change.

The xml will be retrieved from a database using Linq; if I could combine both queries so instead of getting the entire serialized graph and then extracting the collection objects I would just get back the collection that would be sweet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:16:11+00:00Added an answer on May 10, 2026 at 2:16 pm

    Will,

    It is not possible to find out whether an object implements some interface by looking at XAML.
    With constraints given you can find xml element that has a child named .

    You can use following code: It will return all elements having child element which name ends with .TheCollection

        static IEnumerable<XElement> FindElement(XElement root)     {         foreach (var element in root.Elements())         {             if (element.Name.LocalName.EndsWith('.TheCollection'))             {                 yield return element.Parent;             }             foreach (var subElement in FindElement(element))             {                 yield return subElement;             }         }     } 

    To make sure that object represented by this element implements some interface you need to read metadata from your assemblies. I would recommend you to use Mono.Cecil framework to analyze types in your assemblies without using reflection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pretty sizeable object graph that I have serialized to a file
I have this object graph, I want to map: abstract Account (username, password, ...)
So I have an object graph, let's just say it's an order. You have
The situation is this: You have a Hibernate context with an object graph that
I have an object that is mapped to a cookie as a serialized base-64
I have an object of the type System.Drawing.Image and want to make every pixel
I have an object of class F. I want to output the contents of
I have an object that I'd like to serialize and distribute between processes as
I have object A which in turn has a property of type Object B
I have an object in a multi-threaded environment that maintains a collection of information,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.