相关疑难解决方法(0)

使用LINQ迭代类属性

有一个ParsedTemplate类,它有超过300个属性(类型为Details和BlockDetails).parsedTemplate对象将由函数填充.填充此对象后,我需要一个LINQ(或其他方式)来查找是否有任何属性,如"body"或"img"where IsExist=falsePriority="high".

public class Details
{
    public bool IsExist { get; set; }
    public string Priority { get; set; }
}

public class BlockDetails : Details
{
    public string Block { get; set; }
}

public class ParsedTemplate
{
    public BlockDetails body { get; set; }
    public BlockDetails a { get; set; }
    public Details img { get; set; }
    ...
}
Run Code Online (Sandbox Code Playgroud)

.net c# linq linq-to-objects

6
推荐指数
1
解决办法
2527
查看次数

标签 统计

.net ×1

c# ×1

linq ×1

linq-to-objects ×1