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

  • Home
  • SEARCH
  • 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 6008457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:49:35+00:00 2026-05-23T01:49:35+00:00

I have a Dictionary with some simple string,string value pairs. The problem is that

  • 0

I have a Dictionary with some simple string,string value pairs. The problem is that sometimes the key has to be empty for multiple items, which gives a dictionary error ->

 this key already exists.

Is there another class for this?

Also, I’m using .NET 2.0 so I can’t use the Tuple class …

while (nav.MoveToNext())
{
    if (nav != null)
    {
        if (!String.IsNullOrEmpty(nav.Value))
        {
            if (nav.HasChildren)
            {
                navChildren = nav.Clone();
                navChildren.MoveToFirstChild();
                if (navChildren != null)
                    if (!veldenToSkip.Contains(nav.LocalName.Trim().ToLower())
                        && !nav.LocalName.StartsWith("opmerkingen_"))
                        itemTable.Add(nav.LocalName.Replace("_", " "), navChildren.Value);
                         //normal key and value
                while (navChildren.MoveToNext())
                {
                    if (!veldenToSkip.Contains(nav.LocalName.Trim().ToLower()))
                    {
                        if (navChildren != null)
                        {
                            if (!String.IsNullOrEmpty(navChildren.Value))
                            {
                                itemTable.Add("", navChildren.Value);
                                //Add blank keys
                            }
                        }
                    }
                }
            }
        }
    }
}

I only want a structure like this:

value1    value2
value3    value4
          value5
          value6
value7    value8
...
  • 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-23T01:49:36+00:00Added an answer on May 23, 2026 at 1:49 am

    Just generate a pseudo-key…

    int emptyKey = 0;
    
    ...
    if (!String.IsNullOrEmpty(navChildren.Value))
    {
       string key = "Empty_" + emptyKey.ToString();
       emptyKey ++;
       itemTable.Add(key, navChildren.Value);
       //Add blank keys
    }
    

    You’ll still have the Values, but note that a Dictionary does not preserve order (of Adding).

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

Sidebar

Related Questions

I have a key/value pairs mapped by hash (ID) in Dictionary<string, Dictionary<string, string>> called
I have a Dictionary that when I add multiple values to it, the items
I have a Dictionary<string,int> that has the potential to contain upwards of 10+ million
I have a simple Dictionary(of String, Object) that I need to iterate through and
I have a Dictionary<string, someobject> . EDIT: It was pointed out to me, that
I have a dictionary that I normally access with a key, so I need
I have a database table that is a dictionary of defined terms -- key,
I have a class that inherits from a dictionary in order to add some
I have a WCF application, written in VB.NET that takes a generic Dictionary(Of String,
I have a dictionary of 200,000 items (the keys are strings and the values

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.