c# - LINQ query where complete group meets a condition -
i have stored lot of text lines this:
1|1000|1|0|text message||| 1|1000|1|1|text message||| 1|1000|2|0|text message||| 1|1000|2|1|text message||| 1|1000|3|0|text message||| 1|1001|1|0|text message||| in collection: list<objrow> listrows
and corresponding class:
public class objrow { private string n_par { get; set; } private string n_rad { get; set; } private string n_lang { get; set; } private string n_line_mex { get; set; } private string text_mex { get; set; } private int n_row { get; set; } } i find groups of lines (grouped property n_rad, 2° pipe value) have not value n_lang == 3 (3° pipe value).
how linq?
this should want:
var groupswithoutlang3 = listrows .groupby(o => o.n_rad) .where(g => !g.any(o => o.n_lang == "3")); it selects groups without objrow n_lang == "3".
Comments
Post a Comment