|
-
Aug 8th, 2013, 10:51 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Question on WCF [DataContract] with List datatype
Okay, I have a WCF app that has the following data contracts (at least that are relevant to my problem).
Code:
[DataContract]
public class PolicyGroup
{
[DataMember]
public int GroupID { get; set; }
[DataMember]
public int? GroupNum { get; set; }
}
[DataContract]
public class Policy
{
[DataMember]
public int PolicyID { get; set; }
[DataMember]
public String PolicyNum { get; set; }
[DataMember]
public List<PolicyGroup> Groups { get; set; }
}
As you can see, I've got a Policy that contains a list of groups. When I declare a Policy object in the client, however, the Groups element isn't a list of groups, it is an ARRAY of groups. There are any number of reasons why I want it to be a list rather than an array, but I don't even know WHY this happened, much less how to fix it.
So what do I need to do so that the client app can deal with a list of groups as defined in the data contract?
-
Aug 8th, 2013, 11:30 AM
#2
Thread Starter
Hyperactive Member
Re: Question on WCF [DataContract] with List datatype
Nevermind, I found my solution.
In the client app's solution explorer, I went to the Service reference, right-clicked it, and chose "Configure Service Reference". Under "Data Type" on the resulting pop-up, I selected "System.Collections.Generic.List" as the Collection Type that would be generated on the client. It defaulted to array.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|