• Linq中几个扩展方法的使用


    一个List 保存是ClassOrganization 的实体的信息

    依据某个ClassOrganization实体的ID在List中查找该实体,如:

    ClassOrganization org = orgList.Find(o=>o.Orgid==orgId);

    依据某个ClassOrganization实体的ID判断List中是否有该实体,如:

    orgList.Exists(o => o.Orgid == OrgID)

    //IList

     IList<Vanceinfo.Vsg.SystemAdmin.Entity.SmRole> roleList = BusinessCommon.Instance.GetUserRole(userCode, out userId);

    int count = roleList.Count<Vanceinfo.Vsg.SystemAdmin.Entity.SmRole>(r => r.RoleName == "公告管理"); //得到在列表中指定条件的角色数量

     if(count>0)

    {

      //证明有该记录

    }

    查找IList中的某个实体

    IList<BudgetData> list = bll.GetListByCondition(type, iBugetType);

    if (!string.IsNullOrEmpty(strYear))
                    {
                        strYearMonth = strYear + "-" + strMonth;

                        obj = list.SingleOrDefault<BudgetData>(b => b.YearMonth == strYearMonth && b.DepartCode == strDepart);
                    }

  • 相关阅读:
    面向对象之prototype,__proto__
    Screen对象
    location对象
    history对象
    JS计时器
    window对象
    Dom操作html详细
    终端 git log 修改样式
    null 和 NULL 判断
    textfield设置左边距
  • 原文地址:https://www.cnblogs.com/vihone/p/1764645.html
Copyright © 2020-2023  润新知