Select multiple records based on list of Id's with linq

前端 未结 4 890
再見小時候
再見小時候 2020-11-30 18:31

I have a list containing Id\'s of my UserProfile table. How can i select all UserProfiles based on the list of Id\'s i got in a var us

4条回答
  •  独厮守ぢ
    2020-11-30 18:58

    That should be simple. Try this:

    var idList = new int[1, 2, 3, 4, 5];
    var userProfiles = _dataContext.UserProfile.Where(e => idList.Contains(e));
    

提交回复
热议问题