本文整理汇总了C#中Model.List.FindAll方法的典型用法代码示例。如果您正苦于以下问题:C# List.FindAll方法的具体用法?C# List.FindAll怎么用?C# List.FindAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model.List
的用法示例。
在下文中一共展示了List.FindAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateJudge
/// <summary>
/// 验证是否有重复项
/// </summary>
protected bool ValidateJudge()
{
DataGridViewRowCollection ds = dgvWareHouseList.Rows;
List<DataGridViewRow> list = new List<DataGridViewRow>();
foreach (DataGridViewRow item in ds)
{
list.Add(item);
}
var ak47 = list.GroupBy(q => q.Cells[0].Value).Where(s => s.Count() > 1).Select(v => v);
if (ak47.Count() > 0)
{
//只要有一行相等就退出
MessageBoxEx.ShowError("新增加的“货位编号”重复!");
int i = 0;
foreach (var item in ak47)
{
List<DataGridViewRow> ColorRow = list.FindAll((V) =>
{
return V.Cells[0].Value.Equals(item.Key.ToString());
});
i++;
if (i == 1)
{
ColorRow.ForEach((U) =>
{
U.DefaultCellStyle.BackColor = Color.Lime;
});
}
if (i == 2)
{
ColorRow.ForEach((U) =>
{
U.DefaultCellStyle.BackColor = Color.Orange;
});
}
if (i == 3)
{
ColorRow.ForEach((U) =>
{
U.DefaultCellStyle.BackColor = Color.BlueViolet;
});
}
}
return false;
}
return true;
}
示例2: ToBuiConfigList
public List<vm_BUI_config> ToBuiConfigList(List<RoleAuthorization> authList)
{
List<vm_BUI_config> resultList = new List<vm_BUI_config>();
var topLevelList = authList.FindAll(t => t.Level == 1);
foreach (var topInfo in topLevelList)
{
var secondLevelList = authList.FindAll(t => t.Level == 2 && t.ParentId == topInfo.FunctionId);
if (secondLevelList.Count == 0)
continue;
vm_BUI_config configInfo = new vm_BUI_config();
configInfo.id = topInfo.FunctionId.ToString();
configInfo.homePage = secondLevelList.OrderBy(t => t.Order).FirstOrDefault().FunctionId.ToString();
vm_bui_menuContainer containerInfo = new vm_bui_menuContainer();
containerInfo.text = topInfo.FunctionName;
containerInfo.items = new List<vm_bui_menu>();
foreach (var secondmenu in secondLevelList)
{
vm_bui_menu theMenuInfo = new vm_bui_menu();
theMenuInfo.href = secondmenu.Url;
theMenuInfo.id = secondmenu.FunctionId.ToString();
theMenuInfo.text = secondmenu.FunctionName;
containerInfo.items.Add(theMenuInfo);
}
configInfo.menu = new List<vm_bui_menuContainer>();
configInfo.menu.Add(containerInfo);
resultList.Add(configInfo);
}
return resultList;
}