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

The Archive Base Latest Questions

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

I have a WCF service that needs to expose a custom collection to it’s

  • 0

I have a WCF service that needs to expose a custom collection to it’s clients. I wondered what would be the best way to expose this object to my clients?

Object Code:

  public class ListBoxDataCollection : System.Collections.CollectionBase
{
    public ListBoxDataCollection()
    {
    }

    public ListBoxData this[int index] 
    {
        get { return (ListBoxData)this.List[index]; }

        set { this.List[index] = value; }
    }

    public int IndexOf( ListBoxData item )
    {
        return base.List.IndexOf(item);
    }

    public int Add( ListBoxData item )
    {
        return this.List.Add(item);
    }

    public void Remove( ListBoxData item )
    {
        this.InnerList.Remove(item);  
    }

    public void CopyTo( Array array, int index )
    {
        this.List.CopyTo(array, index);
    }

    public void AddRange( ListBoxDataCollection collection )
    {
        for (int i = 0; i < collection.Count; i++)
        {
            this.List.Add(collection[i]);
        }
    }

    public void AddRange( ListBoxData[] data )
    {
        this.AddRange(data);
    }

    public bool Contains( ListBoxData item )
    {
       return this.List.Contains(item);
    }

    public void Insert( int index, ListBoxData item )
    {
        this.List.Insert(index, item);
    }
}
  • 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-12T20:10:10+00:00Added an answer on May 12, 2026 at 8:10 pm

    Are you on .NET 3.5 or up? In that case, I would recommend List<ListBoxData> which seems like the easiest way to go. WCF was no trouble at all with generic lists – worst case it’ll model them as an array of ListBoxData on the client.

    If you own both ends of the communication, you could put the data contracts (and service contracts) into a shared assembly and use it on both ends, thus getting around this problem – in that case, you could use List<ListBoxData> on both ends of the communication.

    Marc

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

Sidebar

Related Questions

I have a WCF service that needs to notify it's clients when changes occur
I have a WCF service that needs to hosted using basicHttpBinding using SSL. So
I have a WCF service that needs to be secured via https. The WCF
I have a WCF service that needs to be secured to be consumed by
I have the following data model: I am writing a WCF service that needs
I have a WCF service that I am calling from multiple clients. I need
I have created a WCF service that needs to be hosted in a Window
I have written a service that I would like expose both via rest and
I have a WCF service that needs to return different types of Quotes (ie
I currently have a WCF service that exposes a SOAP enpoint. In this webservice

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.