[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?
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.