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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:32:24+00:00 2026-05-20T23:32:24+00:00

I want to return the Dictionary collection from the webservice. Since we could not

  • 0

I want to return the Dictionary collection from the webservice. Since we could not directly return Dictionary Type from the webservice, I made the Serializable Dictionary as described in this link

It is fine and I could return the collection as xml below:

<?xml version="1.0" encoding="utf-8"?>
<SerializableDictionaryOfStringString xmlns="http://tempuri.org/">
  <Item>
    <Key>
      <string xmlns="">k1</string>
    </Key>
    <Value>
      <string xmlns="">abcdef</string>
    </Value>

  </Item>
  <Item>
    <Key>
      <string xmlns="">k2</string>
    </Key>
    <Value>
      <string xmlns="">xyz</string>
    </Value>

  </Item>
</SerializableDictionaryOfStringString>

However, the problem occurs when consuming this webservice. Instead of the SerializableDictionary Return Type, my web service method shows the return data type as DataSet. I don’t know how to handle the return data and utilize because although it returns as the Dataset, it is not actually the dataset and I could not do anything with it such as bind to gridview, ds.tables[0], etc….

So, how can I manipulate the return data from the webservice?

  • 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-20T23:32:24+00:00Added an answer on May 20, 2026 at 11:32 pm

    A dictionary is not the most logical choice for a DTO (Data Transfer Object).

    Take a step back, what do you want to return from Server to Consumer?

    I think it is just

    class MyDTO { public string Key {get; set; } public string Value {get; set; } }
    
    public List<MyDTO> Servermethod() { ... }
    

    Add the [WebMethod] , [Serializable] or [OperationContract] , [DataContract] attributes as necessary.

    And then it is up to the Client to create a Dictionary from the List is that’s convenient.

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

Sidebar

Related Questions

I have a datareader and i want to return collection of rows from it,
I'm using a System.Collections.Generic.Dictionary<string, string> . I want to return the first key from
I have a Dictionary data base and I want to return an element from
I want a dictionary that would return a specified value for any key not
I want to return a private field from a remoted object but i get
I want to return a set of values from function till the point they
I want to return nothing when if condition is not met, for instance (if
I'm getting this error: The model item passed into the dictionary is of type
I want to return a dictionary of elements by assigning each value of a
I'm trying to put sub-child values from XML into a dictionary collection using LINQ.

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.