【发布时间】:2012-03-29 13:35:16
【问题描述】:
我想通过 WCF 发送Appointments 的列表。我的界面如下所示:
[ServiceContract]
public interface IServices
{
[OperationContract]
string addAppointments(List<Appointment> appointmentList);
}
如果我调用我的 WCF 服务,我总是会收到以下错误:
类型“Microsoft.Exchange.WebServices.Data.Appointment”不能 序列化。考虑用 DataContractAttribute 标记它 属性,并标记您想要序列化的所有成员 DataMemberAttribute 属性。请参阅 Microsoft .NET 框架 其他受支持类型的文档。
我的服务目前如下所示:
class Service : IServices
{
public string addAppointments(List<Appointment> appointmentList)
{
foreach (Appointment app in appointmentList)
{
Console.WriteLine(app.Organizer.Name);
}
return "true";
}
}
【问题讨论】:
-
看起来
Microsoft.Exchange.WebServices.Data.Appointment是你从其他地方得到的一个类,它不打算被序列化。
标签: wcf exchangewebservices generic-list appointment