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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:02:29+00:00 2026-05-17T19:02:29+00:00

Can I use an Array of Dictionary objects? I have an XML which I

  • 0

Can I use an Array of Dictionary objects?

I have an XML which I would like to modify. The Data Structure that I am to use is this –

Dictionary<element, Dictionary<attr, value>>

element – is the Element which I am about to modify
attr – the attribute whose value I am going to update
value – the value with which I am to update

<Parents>
    <Parent id="ParentA" description="New">
        <Children>
            <Child name="ChildA" />
        </Children>
    </Parent>
</Parents>

I would want to pass the following

Dictionary<string, string> dict_Attributes1=new Dictionary<string, string>();
Dictionary<string, string> dict_Attributes2=new Dictionary<string, string>();
dict_Attributes1.Add("id", "ParentB");
dict_Attributes1.Add("description", "Old");
dict_Attributes2.Add("name", "ChildB");
Dictionary<string, Dictionary<string, string>> dict_Elements = new Dictionary<string, Dictionary<string, string>>();
dict_Elements.Add(".", dict_Attributes1);//To update the Element
dict_Elements.Add("Children/Child", dict_Attributes2);//To update the Children's Attributes

Let us assume that I have already identified that I am to update Parent whose id is ParentA.

Now, here I am creating dict_Attributes1, dict_Attributes2 etc., is there a way I can have them stored in an (dynamic, size unknown at compile time) Array of Dictionary objects?

Alternatively, is there a better way of doing this –
1. Modify the attributes of a Selected XElement and its children’s attributes?

EDIT

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
    <Environments>
        <Environment id="Master" description="MasterSystem">
            <Systems>
                <DefaultSystem systemName="Master" server="http://localhost" />
            </Systems>
        </Environment>
    </Environments>
</Configuration>

Now, when a user changes the id and description, I want to update this XML file with the new values. While changing the id and description (which are obtained from the user), I want to update the systemName as well with the same value of id.

If the new id is “Development” and description is “DevelopmentSystem”,

The output XML should be

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
    <Environments>
        <Environment id="Development" description="DeveloperSystem">
            <Systems>
                <DefaultSystem systemName="Development" server="http://localhost" />
            </Systems>
        </Environment>
    </Environments>
</Configuration>
  • 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-17T19:02:29+00:00Added an answer on May 17, 2026 at 7:02 pm

    Yes, it is possible. I’m not sure which of these you need, but they both use a List<T>:

    var list = new List<Dictionary<string, string>>();
    

    Or:

    var list = new List<Dictionary<string, Dictionary<string, string>>>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which algorithm does the JavaScript Array#sort() function use? I understand that it can take
I have a RESTful WCF service that can return XML, JSON, or JSONP, depending
Related: How can I use polymorphism in XML Serialization? I have a class I
I am trying to build an array that contains arrays of dictionary objects in
I use Boost.Serialization to serialize a std::map. The code looks like this void Dictionary::serialize(std::string
i have an array of custom objects. i'd like to be able to reference
I've always wanted to send objects that you can serialize in XML across websites,
In Java, we can always use an array to store object reference. Then we
What function can I use in Excel VBA to slice an array?
I can use VS08's MFC/ActiveX template to create a C++ ActiveX object that I

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.