VS.net создает шаблон при создании проекта WCF.
Он добавляет класс в файл iService1.cs:
// 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; }
}
}
Так как служба WCF может возвращать любой пользовательский класс, зачем использовать класс DataContract и CompositeType?
Я могу вернуть что-то вроде:
[OperationContract]
MyUserCollection GetUsers();
Что мне не хватает?