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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:26:52+00:00 2026-05-14T02:26:52+00:00

I have a simple Silverlight app which simply sets a DataGrid’s ItemsSource to the

  • 0

I have a simple Silverlight app which simply sets a DataGrid’s ItemsSource to the result of a web service. This all works OK, but now I am trying to make it more abstract. I would like to pass a parameter to the web service and return either a List<Customer> or a List<Product> for example depending on the parameter.

But I just can’t seem to find a way to pass back an abstract list. It seems it has to be a list of a specific type. Is this right?

Thanks,

AJ

  • 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-14T02:26:53+00:00Added an answer on May 14, 2026 at 2:26 am

    The web service definition must know the structure of what is being returned so that it knows what fields to include in the SOAP envelope and so that the subscriber to that service knows what to expect. If you want to return one or the other you should use 2 different services or create a type that can represent both and return a collection of that, then you’d have to wrap it on the client side so that you can hide the details that don’t relate to the specific use.

    For example,

    struct CustomerOrProduct
    {
       ItemType type = ItemType.Customer; // This indicates the type that the struct is currently representing
    
       string name;     // This is for products and customers
       string address;  // This is for customers only
    }
    

    Obviously this struct needs fleshing out with property accessors, etc. but it should give you the idea. However, I don’t recommend doing it this way. Instead you should use separate services for each type you want to retrieve. After all, if you know enough to pass the needed type as a parameter, you know enough to call a different service.

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

Sidebar

Related Questions

I have a silverlight app that uses a simple Login.aspx page. I have all
I am creating simple app on Silverlight 4. In folder of View I have
I have a simple Silverlight 5 datagrid bound to a ObservableCollection of objects: <sdk:DataGrid
I have a Silverlight 4 app which pulls entities down from a database using
I have a Silverlight 3 application which needs to call WCF service. The WCF
I have silverlight 2.0 application and which uses WCF service to get data and
in my Silverlight 4 app, I try to create a simple UserControl, which will
I have a simple silverlight application and i need to add the web browser
I have to write a simple Silverlight app for WP7. If the phone is
I have a simple Silverlight app that I want to run on Windows Phone

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.