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 6799659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:52:29+00:00 2026-05-26T18:52:29+00:00

I have several models that includes nested classes and lists. Many of the class

  • 0

I have several models that includes nested classes and lists. Many of the class members have attributes that I also have to read in.

I’m looking for a dynamic way (possibly through Linq or Reflection) to retrieve the values and attributes of all generic objects within the specified model.

Any suggestions are welcome.

Edit:

Using the ObjectManager as per x0r’s suggestion, I can see all of the data. The remaining part of this issue requires member annotation. Is there some way to copy over the PropertyInfo of each class member?

ObjectWalker objectWalker = new ObjectWalker(objectToValidate);

foreach (Object o in objectWalker)
{
    if (isGeneric(o.GetType()))
    {    
        PropertyInfo property = o.GetType().GetProperty(o); // <-- This does not work... Need to obtain annotations somehow
        object[] Attributes = property.GetCustomAttributes(typeof(Attribute), true);

        foreach (Attribute attribute in Attributes)
        {
            // Annotations processing goes here
        }
    }
}
  • 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. Editorial Team
    Editorial Team
    2026-05-26T18:52:30+00:00Added an answer on May 26, 2026 at 6:52 pm

    Have a look at the ObjectWalker

    It helps you to parse an object graph and visit all unique elements.
    As you can see it stores only a stack of objects and Current returns an Object.

    You could modify this so the Walker would save a class that contains all the data you need for each property (Like a propertyinfo object or a list of attributes).

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

Sidebar

Related Questions

I have several models with fields that are integers. I also have hashes that
What's the rails way to see posts nested beneath several associative models that a
In Silverlight for Windows Phone I have several view models that are disposable and
I have several models whose records AND associations can have two states that must
I have a rails app with several models. I have a function that I
I have several models: User = an ordinary user class (does not belong to
I have a model with several attributes, among them title and artist . The
I have an Auction model with several attributes, two of which are current_auction:boolean and
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on
We have several jobs that run concurrently that have to use the same config

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.