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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:17:34+00:00 2026-06-17T17:17:34+00:00

Hashtable mainhash = new Hashtable(); testdata td = new testdata() { value = td

  • 0

Hashtable mainhash = new Hashtable();

        testdata td = new testdata() { value = "td" };
        td.hash.Add("1", "tdvalue1");
        td.hash.Add("2", "tdvalue2");
        td.hash.Add("3", "tdvalue3");
        td.hash.Add("4", "tdvalue4");
        td.hash.Add("5", "tdvalue5");

        testdata td1 = new testdata() { value = "td1" };
        td1.hash.Add("1", "td1value1");
        td1.hash.Add("2", "td1value2");
        td1.hash.Add("3", "td1value3");
        td1.hash.Add("4", "td1value4");
        td1.hash.Add("5", "td1value5");

        testdata td2 = new testdata() { value = "td2" };
        td2.hash.Add("1", "td2value1");
        td2.hash.Add("2", "td2value2");
        td2.hash.Add("3", "td2value3");
        td2.hash.Add("4", "td2value4");
        td2.hash.Add("5", "td2value5");

        testdata td3 = new testdata() { value = "td3" };
        td3.hash.Add("1", "td3value1");
        td3.hash.Add("2", "td3value2");
        td3.hash.Add("3", "td3value3");
        td3.hash.Add("4", "td3value4");
        td3.hash.Add("5", "td3value5");

        testdata td4 = new testdata() { value = "td4" };
        td4.hash.Add("1", "td4value1");
        td4.hash.Add("2", "td4value2");
        td4.hash.Add("3", "td4value3");
        td4.hash.Add("4", "td4value4");
        td4.hash.Add("5", "td4value5");

        mainhash.Add(1, td);
        mainhash.Add(2, td1);
        mainhash.Add(3, td2);
        mainhash.Add(4, td3);
        mainhash.Add(5, td4);

how to select all the keys using SelectMany by Linq into one list??
what i need to do in this??

var values = mainhash.Values.Cast<testdata>().Select(x => x.hash)
                                             .SelectMany(x=> x.Keys);

what is wrong in this??

  • 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-06-17T17:17:36+00:00Added an answer on June 17, 2026 at 5:17 pm

    It doesn’t know the type to use from Hashtable.Keys.

    Try:

    var values = mainhash.Values.Cast<testdata>().Select(x => x.hash)
                               .SelectMany(x => x.Keys.Cast<string>());
    

    But better: use Dictionary<TKey,TValue> instead of Hashtable.

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

Sidebar

Related Questions

This is my code : Hashtable actualValues = new Hashtable(); actualValues.Add(Field1, Int32.Parse(field1.Value)); actualValues.Add(Field2, Int32.Parse(field2.Value));
Given the following code: Hashtable main = new Hashtable(); Hashtable inner = new Hashtable();
My Hashtable in Java would benefit from a value having a tuple structure. What
public static Hashtable m_results = new Hashtable(); private BindingSource m_bindResults = new BindingSource(); //
I am using a hashtable to store key-value pairs and I initialize this hashtable
I have a problem while checking a hashtable value. In the code below I
I have an hashtable that I add to when I am creating jobs with
My add to hashtable method fails, what have i done wrong? Or what have
Hashtable<String, Hashtable<String, HashSet<String>>> test = new Hashtable<String, Hashtable<String, HashSet<String>>>(); test.put(1, new Hashtable<String, HashSet<String>>()); Hashtable<String,
I have a HashTable in which I have key value pairs like below :

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.