Issue
I want to display all numbers greater than 1 from my list on ListView
foreach (var item2 in listAlert)
{
int maxAlertt = item2.levelForecast;
item2.levelForecast = Math.Max(maxAlertt, maxAlertt);
lstLevel2.ItemsSource = listAlert;
}
listAlert
have data with integers 1,2,3,4 I want to display only 2,3 and 4 in lstLevel2
.
How to do that ?
Solution
you can do this with a LINQ query - you don't need a foreach
loop
lstLevel2.ItemsSource = listAlert.Where(x => x.SomeProperty > SomeValue).ToList();
Answered By - Jason
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.