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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:07:56+00:00 2026-05-16T21:07:56+00:00

2 Questions really, and I’m not sure if I’m doing this right or not…

  • 0

2 Questions really, and I’m not sure if I’m doing this right or not…

I want to send back an array of some sort for an Entity object I created. I’m not really sure how to mark it for sending (what attributes are needed or whatever), and I’m not really sure how to send it back (IList, List, Collection, ICollection).

Ideally I’d love to be able to send back an ObservableCollection, but would that work if a client that wants to consume the service isn’t in .NET?

[ServiceContract(Namespace = "http://www.tempuri.com/MyService",
                 ConfigurationName = "IMyService")]
public interface IMyServie
{
    [OperationContract(Action = "http://www.tempuri.com/MyService/GetUsers",
                       ReplyAction = "*")]
    [XmlSerializerFormat(SupportFaults = true)]
    GetUsersResponse GetUsers(GetUsersRequest request);
}

[MessageContract(IsWrapped = false)]
public sealed class GetUsersRequest
{
    public GetUsersRequest() { }
    public GetUsersRequest(Int32 record = -1)
    {
        Record = record;
    }

    [MessageBodyMember(Namespace = "", Order = 0)]
    public Int32 Record { get; private set; }

}

[MessageContract(IsWrapped = false)]
//[ServiceKnownType(??)]
public sealed class GetUsersResponse
{
    public GetUsersResponse() { }
    public GetUsersResponse(PersonEntity[] entities)
    {
        Entities = entities;
    }

    [MessageBodyMember(Namespace = "", Order = 1)]
    //[XmlElement(DataType = "??")]
    public PersonEntity[] Entities { get; private set; }
    //Should this have been some other type of array-type (Collection, List, etc?)
}

//Does this need any attributes besides Serializable?
[Serializable()]
public PersonEntity : AbstractEntity
{
    public PersonEntity() { }
    public PersonEntity(Int32 id = 0, String fname = "", String lname = "")
    {
        ID        = id;
        FirstName = fname;
        LastName  = lname;
    }

    public String FirstName { get; set; }
    public String LastName { get; set; }

    //Functionality (Clone, Clear, Default, Equals, etc) Removed...
}

[Serializable()]
public abstract class AbstractEntity : IEntity
{
    public Int32 ID { get; set; }

    //Abstracts or Implements some functionality...
}

public interface IEntity
{
    //Defines functionality requirements
}
  • 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-16T21:07:56+00:00Added an answer on May 16, 2026 at 9:07 pm

    DataContract is what you are looking for. For more details check this link

    On Observable collection front, not sure why sending an array would be any different for you. Can you elaborate a bit more to help us understand this.

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

Sidebar

Related Questions

There maybe some simlar questions to this but I can't see anything that really
This questions is not really about code but application design. I have an app
This is really two questions, noted below: Currently I have some public internal helper
This is really two questions: Why isn't the membership operator (__contains__) ever being called?
I'm new to JSwing, so pardon me what might be some really beginners' questions.
This is really a few questions in one, I'm wondering what the performance cost
This consists of two questions: Is MySQL's timestamp field really faster than datetime field
I've some questions .. and I really need your help. I have an application.
I tried to research this, but there were still some questions left unanswered. I
This is really several questions, but anyway... I'm working with a big project in

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.