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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:17:24+00:00 2026-05-18T20:17:24+00:00

I am facing an interesting problem right now. I know it is not that

  • 0

I am facing an interesting problem right now.
I know it is not that pretty but I have to cope with it anyway.

I am calling a webservice that returns (array of string) something like that (by index)
0 – Table Name (“Employees”)
1 – List of all fields returned (“Id, Name, Birthdate”)
2 – First field value (“1”)
3 – Second field value (“Bobby”)
4 – Third field value (“1970-01-01”)

What I would like to accomplish is to create a object name after the index 0, having all the strings in the index 1 being all the properties and feed them with their proper value.

What would be the best way to accomplish this? I have started reading about the ExpandoObject but before going too far I would like to hear your take on this.

Regards

EDIT: I will have quite a few different tables to fetch the data from, that is what is causing me the problem.

  • 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-18T20:17:24+00:00Added an answer on May 18, 2026 at 8:17 pm

    It depends on your use-case but I doubt that dynamic is the way to go here. I would just have a name-value collection like so:

    class Result {
        Dictionary<string, string> values = new Dictionary<string, string>();
        public string this[string name] {
            get {
                return this.values[name];
            }
            set {
                this.values[name] = value;
            }
        }
    
        // some details
    }
    

    Then you can populate the values from the webservice and query the values by saying

    Result result = PopulateResultFromWebservice();
    string id = result["Id"];
    

    etc. If you knew the types you could make this indexer of type object instead and parse the values to their appropriate type and store them as those typed objects.

    The issue with dynamic is that if the names of the fields are an unknown, how are you possibly going to write code that utilizes those fields?

    EDIT: I will have quite a few different tables to fetch the data from, that is what is causing me the problem.

    Dude, name-value collection all day every day.

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

Sidebar

Related Questions

I am facing an interesting problem right now. I know it is not that
I have an interesting database problem. I have a DB that is 150GB in
I'm facing an interesting problem here. I have a piece of code where I'd
I am facing a problem that I can not understand . During a plugin
Facing a problem, it seems my data stored in SQL Server does not stored
Im facing an issue which I believe to be VAO-dependant, but Im not sure..
I have started playing around with Berkeley DB. This one is really interesting, but
im facing a problem where i need some advice. I want to have a
I am facing an interesting problem while working on Google Map Page. Actually I
I am facing a really very interesting problem with string. My code is: Dim

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.