linq select id from list id code example
Example 1: linq where id in list
var result = _dataContext.table.Where(x => idList.Contains(x.Id));
Example 2: how to query items with any id in a list of ids linq c#
var userProfiles = _dataContext.UserProfile
.Where(t => idList.Contains(t.Id));
Example 3: linq find object from id
MyObject myObject = collectionMyObject.FirstOrDefault(o => o.Items != null && o.Items.Any(io => io.Id == 2));