我有以下两个类
public interface INotification
{
int Id { get; set; }
bool IsNotificationShown { get; set; }
DateTime NotificationDate { get; set; }
}
public class Notification : INotification
{
public int Id
{
get;
set;
}
public bool IsNotificationShown
{
get;
set;
}
public DateTime NotificationDate
{
get;
set;
}
}
WebAPI控制器具有以下操作,我有易于读取的硬编码值
public List<INotification> Get()
{
INotification notif = new Notification { Id = 1, IsNotificationShown = false, NotificationDate = DateTime.Now, NotificationDescription = "Desc", NotificationFrom = "Abcd", NotificationTo = "Abcd", NotificationTypeId = 1 } ;
return new List<INotification> { notif };
}
当我在浏览器上运行时,我收到以下错误
'ObjectContent`1'类型无法序列化内容类型'application / xml的响应正文;字符集= UTF-8' 。
只要我将返回类型从INotification更改为Notification,它就可以正常工作。有没有人对如何解决这个问题有任何建议?
答案 0 :(得分:2)
只需将属性A = np.arange(m)[:, None] * np.arange(n)[None, :]
添加到您的班级即可。像这样:
KnowType