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

The Archive Base Latest Questions

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

I was wondering if it were possible to make a list from the dictionary

  • 0

I was wondering if it were possible to make a list from the dictionary values where the key is a specified value?

The dictionary would like this:

Sidcup – DPC1
Sidcup – DPC2
Blackheath – DPC3
Blackheath – DPC4
Bexleyheath – DPC5

In fact, I’m not entirely implementing a Dictionary as above is a good idea. Here is its implementation:

DataSet ds = EngineBllUtility.GetDPCsForImportFile(connectionString, fileID);
if (ds.Tables.Count > 0)
{
    DataTable dtDPCs = EngineBllUtility.GetDPCsForImportFile(connectionString, fileID).Tables[0];
    Dictionary<string, string> preliminaryList = new Dictionary<string, string>();

    if (dtDPCs.Columns.Contains("DPCNumber") && dtDPCs.Columns.Contains("BranchName"))
       foreach (DataRow dataRow in dtDPCs.Rows)
       {
            preliminaryList.Add(dataRow["BranchName"].ToString(), dataRow["DPCNumber"].ToString());
       }

I have the following code: (Excuse the last line, its just so you have an idea of what I’m trying to do).

foreach (string branch in branchNames)
{
    string subfolder = System.IO.Path.Combine(saveLocation, branch);
    System.IO.Directory.CreateDirectory(subfolder);

    List<string> certificateList = new List<string>();

    certificateList.Add(DPCNumber in preliminaryList where Key = branch);
}

In the above the branch is the key from the Dictionary. I need to iterate through because it needs to create a new folder and then do something with the certificateList I am creating.

  • 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-28T01:36:50+00:00Added an answer on May 28, 2026 at 1:36 am

    Sure:

    private static void TestZip()
        {
            Dictionary<string, string> stringstringdic = new Dictionary<string, string>();
            stringstringdic.Add("1", "One");
            stringstringdic.Add("2", "Two");
            stringstringdic.Add("3", "Three");
            stringstringdic.Add("4", "Four");
            stringstringdic = stringstringdic.Where(pair => pair.Key != "1")
                                             .ToDictionary(pair => pair.Key, pair => pair.Value);
            List<string> stringlist = stringstringdic.Keys.Concat(stringstringdic.Values).ToList();
            foreach (string str in stringlist)
            {
                Console.WriteLine(str);
            }
        }
    
    //Output:    
    //2
    //3
    //4
    //Two
    //Three
    //Four
    

    Of course, you’ll have to change the Where clause to reflect your real need.
    If I understood you right, it’s like .Where(pair => pair.Key == branch)

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

Sidebar

Related Questions

I'm wondering if its possible to make a list like this: Or should I
i'm wondering about this possibility. Is it possible to make our code written in
I'm wondering if it's possible to make a method which behaves differently when called
I am wondering whether it is possible to make dynamic variables in Java. In
I was wondering if it is possible to make a new file inside the
I was wondering if it is possible to make a label a hyperlink? Below
I'm wondering if its possible to make the following code more concise: $('#americasTrigger').hover( function
I was wondering if it would be possible to use jQuery's ajax function to
I'm trying to make a deep copy of a generic list, and am wondering
I'm wondering if it's possible to make the iPhone app project I have into

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.