Articles → WCF → List Converted To Array While Consuming WCF Service
List Converted To Array While Consuming WCF Service
[ServiceContract]
public interface IService1 {
[OperationContract]
string GetData(int value);
[OperationContract]
List < CompositeType > GetDataUsingDataContract(CompositeType composite);
// TODO: Add your service operations here
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class CompositeType {
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue {
get {
return boolValue;
}
set {
boolValue = value;
}
}
[DataMember]
public string StringValue {
get {
return stringValue;
}
set {
stringValue = value;
}
}
}
public class Service1: IService1 {
public string GetData(int value) {
return string.Format("You entered: {0}", value);
}
public List < CompositeType > GetDataUsingDataContract(CompositeType composite) {
return new List < CompositeType > ();
}
}
Click to Enlarge
Solution
Click to Enlarge
Click to Enlarge
Click to Enlarge