I have a class like this:
public class FileCollection:ObservableCollection<IUserFile>.
From within the class, I would like to get a subset of the collection, based on a list of names.
I imagine it would be something like this:
List<IUserFile> selectedFiles = new List<IUserFile>;
foreach(string s in names)
{
var matchingFiles = this.SelectMany(userFile => userFile.Name.Equals(s));
foreach(IUserFile uf in matchingFiles)
{
selectedFiles.Add(uf);
}
}
At this point, I'm having trouble with the Select or SelectMany call; the compiler error messages are not that helpful.
Any suggestions on how to extract the subset from the collection would be appreciated...