Below is the point that I want to implement
Here are the two method which return the list
var tracklist = _sidRepo.GetTrackSidList(request.systemType);// return point no 2
var SidList = _sidRepo.GetAllList();// return the whole sid list
Now the question is I have list of Sid objects in tracklist , I want to check trackId property if its present in the second list with InUse property of second list is true, If its true I do not want to check it again and add condition that TrackId is check already and move on to next trackid from tracklist . Any idea?
Not completely sure what you want. But from what I understand you can try this
var tracklist = _sidRepo.GetTrackSidList(request.systemType);// return point no 2
var SidList = _sidRepo.GetAllList();// return the whole sid list
// Create a that will track if a trackId has already been checked
var trackIds = new List<int>();
var validTracks = new List<Sid>();
// we create a list of possible ids
var secondListIds = SidList.Select(x => x.TrackId);
// Loop through
foreach(var track in tracklist){
// Check the exit condition
if (trackIds.Contains(track.TrackId))
continue;
// Ok so we havn't seen this track ID before
// We can check if it the Second list contains it
if (secondListIds.Contains(track.TrackId))
// It Does so we add it to the valid Track Ids
validTracks.add(track);
// Finally add the it to the check list
trackIds.Add(track.TrackId);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.