我想Appointment
通过 WCF 发送一个 s 列表。我的界面如下所示:
[ServiceContract]
public interface IServices
{
[OperationContract]
string addAppointments(List<Appointment> appointmentList);
}
如果我调用我的 WCF 服务,我总是会收到以下错误:
无法序列化类型“Microsoft.Exchange.WebServices.Data.Appointment”。考虑使用 DataContractAttribute 属性对其进行标记,并使用 DataMemberAttribute 属性标记您想要序列化的所有成员。有关其他支持的类型,请参阅 Microsoft .NET Framework 文档。
我的服务目前看起来像这样:
class Service : IServices
{
public string addAppointments(List<Appointment> appointmentList)
{
foreach (Appointment app in appointmentList)
{
Console.WriteLine(app.Organizer.Name);
}
return "true";
}
}