【发布时间】:2014-05-23 06:31:21
【问题描述】:
我有两个类如下:
public class Notification
{
public System.Guid NotificationId { get; set; }
public Nullable<System.Guid> ClassId { get; set; }
public Nullable<System.Guid> SentBy { get; set; }
public string SenderName { get; set; }
public Nullable<bool> Visible { get; set; }
public string MessageText { get; set; }
public Nullable<System.Guid> ClassViewRegId { get; set; }
public string CreatedBy { get; set; }
public Nullable<System.DateTime> CreatedDate { get; set; }
public string LastModifiedBy { get; set; }
public Nullable<System.DateTime> LastModifiedDate { get; set; }
public List<MessageRecipient> Recipients { get; set; }
}
public partial class Recipient
{
public System.Guid NotificationRecipientId { get; set; }
public System.Guid NotificationId { get; set; }
public string RecipientType { get; set; }
public Nullable<System.Guid> RecipientId { get; set; }
public Nullable<System.Guid> ClassId { get; set; }
public Nullable<System.Guid> ClassViewRegId { get; set; }
}
现在我的代码有 List 有另一个列表 List。
所以我尝试检查并更改值如下:
notify.Where(n => n.Recipients.Where(r => r.RecipientType == "Teacher").ToList().ForEach(s=>s.RecipientType="");
请任何人帮助我如何检查和更改子列表属性的值。
【问题讨论】: