Try:
List<Userdetails> allDetails = new List<Userdetails>() {
new Userdetails() { UserId=1,UserName="A"},
new Userdetails() { UserId=2,UserName="B"},
new Userdetails() { UserId=3,UserName="C"},
new Userdetails() { UserId=4,UserName="D"},
new Userdetails() { UserId=5,UserName="E"},
new Userdetails() { UserId=6,UserName="F"}};
List<int> newIds = new List<int>();
newIds.Add(2);
newIds.Add(3);
List<Userdetails> result = allDetails.Where(ud => newIds.Contains(ud.UserId)).ToList();