C# list 筛选FindAll

例如:参数a、list b、ModelId;根据ModelId参数进行筛选

  /// <summary>
/// 根据ModelId筛选查询出对应的数据
/// </summary>
/// <param name="list"></param>
/// <param name="ModelId"></param>
/// <returns></returns>
private List<GetSellerOrdersRealItemsParms> selectList(List<GetSellerOrdersRealItemsParms> list, int ModelId)
{
if (ModelId != )
{
return list.FindAll(delegate(GetSellerOrdersRealItemsParms info)
{
if (info.ModelId == ModelId)
{
return true;
}
else
{
return false;
}
});
}
else
{
return list.FindAll(delegate(GetSellerOrdersRealItemsParms info)
{
return true;
});
}
}

调用代码:

  List<GetSellerOrdersRealItemsParms> list_GetSellerOrdersRealItemsParms = new List<GetSellerOrdersRealItemsParms>();
list_GetSellerOrdersRealItemsParms = selectList(list, request.ModelId);
上一篇:Arcengine10下载地址


下一篇:.net 制作二维码