counting integers in a list

c#, linq

Solution

Use `Count`

var count = list.Count(item => item.NoNotEncounterBarriersResult)

http://msdn.microsoft.com/en-us/library/bb535181.aspx

Problem

I have a collection of integers in a list. I know I can do something like this to get a specific occurence: ``` List<ResultsViewModel> list = data.ToList<ResultsViewModel>(); Response.Write(list[2].NoNotEncounterBarriersResult); ``` But how can I loop through and count number of instances of `list[i].NoNotEncounterBarriersResult = true`and return the result as an integer?

Original source