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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:44:27+00:00 2026-05-24T05:44:27+00:00

How could I define a simple hierarchy in some easy to read format and

  • 0

How could I define a simple hierarchy in some easy to read format and then iterate/navigate through it in C#?

I imagine I could just define a set of classes and get the properties, but I would rather use a less code-looking format, something xml-ish or even plain text – for example..

<root>
  <level1 name="whatever">
    <sublevel1 />
    <sublevel2 />
  </level1>
  <level2 />
  <level3 />
</root>

or maybe something the asp.net MVC model binder just made me think of

Root.Name=Thing
Root.Type=Object

Root.SubLevel[0].Name=SomeItems
Root.SubLevel[0].Type=Collection

Root.SubLevel[1].Name=OtherThing
Root.SubLevel[1].Type=Object
Root.SubLevel[1].SubLevel[0].Name=OtherItems
Root.SubLevel[1].SubLevel[0].Type=Collection

Anyway, the simpler the better. The idea would be to iterate through the hierarchy and repeat various actions using its properties – like “Name”, “Type”, etc. I would also like to be able to use the index (in the second example) or just be able to keep track of my position in the structure while navigating through it. How can this be done other than modeling it with classes?

  • 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-24T05:44:28+00:00Added an answer on May 24, 2026 at 5:44 am

    XML is the obvious choice as it is both perfectly suited for hierarchies and there is great support for reading it in C# (especially via System.Xml.Linq.XDocument).

    If you really want an alternative, without knowing why, I would suggest looking at YAML: http://en.wikipedia.org/wiki/Yaml

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

Sidebar

Related Questions

Intel makes microprocessor, so he could define the instruction format and its corresponse assembly
Probably terribly simple, but how could I define which area in my accordion is
I am trying to learn Hibernate and I could create some simple CRUD operation
I have a simple grammar which allows the user to define some objects with
I was just hoping that someone could point me to a reference that defines
Could anybody explain in plain words how Cloud computing works? I have read the
I have a simple style for label controls. I'd like to define a control
I followed a simple example as below. But compile failed. Could you please have
This simple example won't work, gives me: Fatal error: spl_autoload() [function.spl-autoload]: Class GmailServer could
Simple question - why does the Decimal type define these constants? Why bother? I'm

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.