I am trying to create a pair of KeyValue with a lambda expression.
Here is my class and below that is my lambda code. I was unable to create KeyValuePair.
I want to get a collection of KeyValuePair Id, IsReleased for comedy films. I put these KeyValuePair in a HashSet for a quick search .
public class Movie{
public string Name{get;set;}
public int Id{get;set;}
public bool IsReleased{get;set;}
}
List<Movie> movieCollection=
var movieIdReleased= new
HashSet<KeyValuePair<int,bool>>(movieCollection.Where(mov=> mov.Type== "comedy")
.Select(new KeyValuePair<int,bool>(????));
source
share