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

The Archive Base Latest Questions

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

As a beginner to WCF i want to implement a call to the Active

  • 0

As a beginner to WCF i want to implement a call to the Active Directory Service which gets all Users, the method looks like this:

    [OperationContract]
    SearchResultCollection GetAllUsers();

SearchResultCollection is not serializable so i have to make something like this:

[DataContract]
SearchResultCollection

So i have to make my own wrapper class which inherits the SearchResultCollection or use IDataContractSerializer. Both solutions seems not easy.

The question: How is the “standard” approach to use .NET Classes as a return type in a WCF service?

(Writing a own DataContract for my own class seems easy. ;))

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

    I think your best bet is create your own simple POCO class to represent SearchResult, and return a list of these objects. Really you want to be able to control exactly the information you need to send back from the service. For example:

    [Serializable]
    public class MySearchResult
    {
        public string Name { get; set; }
    
        public string Email { get; set; }
    }
    

    And simply iterate the searech results and pull out the properties you need like so:

    var results = new List<MySearchResult>();
    
    foreach (SearchResult r in searchResultCollection)
    {
        results.Add(new MySearchResult
                        {
                            Name = searchResult.Properties["Name"],
                            Email = searchResult.Properties["Email"]
                        });
    }
    

    That way the xml being sent back isn’t bloated with all the properties you don’t need AND you can serialize your own List<MySearchResult> return results. And by the way I have no idea if the Name and Email properties exist I am just showing an example.

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

Sidebar

Related Questions

Absolute beginner question: I have a template file index.html that looks like this: ...
I'm a beginner in WCF, which I have chosen instead of Web Services because
There is a WCF service which is running under IIS. This service accesses the
I would like to add callbacks to my WCF service, so that my client
Beginner help needed :) I am doign an example form a php book which
Once again a very beginner-ish question, but here I go: I would like to
I'm trying to get WCF working with Silverlight. I'm a total beginner to WCF
I'm new to WCF I have to create a WCF service that receives plain
I am building an RTD Server for Excel, that is embedding a WCF Service
(Beginner to HTML) I have made a Photoshop mock-up of the website I want

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.