例如,我有一个简单的类Comment
public class Comment
{
public int SomeValue { get; set; }
}
和Post类
public class Post
{
public ICollection<Comment> Comments { get; set; }
}
我想通过特殊验证创建自我类型
public class Comments : IEnumerable<Comment>
{
private List<Comment> _comments;
public bool IsValid()
{
return _comments.Sum(i => i.SomeValue) < 100;
}
}
如何在邮政模型中将这种类型用作收藏夹?