c# - LINQ query to select range of values in a broken sequence -


given entity, 2 fields, int? , string :

entityid    name --------    -----     1       name1     2       name2     3       name3     4       name4  (null)     name5     6       name6     7       name7 

using linq, how select first 4 entities, before null value?

seems case takewhile:

var query = entities.takewhile(x => x.entityid != null); 

(add tolist() or toarray() appropriate).


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -