Created
September 13, 2018 14:21
-
-
Save csharpforevermore/7a37b0edc7c80e364f7d47929aa1a839 to your computer and use it in GitHub Desktop.
Using Linq, get all item Titles from a list by their IDs that existing in another List<int>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var idsOnly = new List<int>(); | |
var myList = db.Items.Where(item => idsOnly.Contains(item.ID.Value)) | |
.Select(a => a.Title).ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/12597221/using-linq-get-all-items-from-list-that-are-in-another-listint?rq=1