Hi, I have an iEnumerable collection, how do I select only the first 2 items without looping? i’ve seen the code somewhere it looks like next() and skip() but I’m not exactly sure how it works
@lakshman
so if I want to extract it as an Array, is this the code?
arr = enum.Take(2).ToArray?
1 Like
yes @DEATHFISH that should work…
ok now the error that I’m facing is that enum is type iEnumerable<Object>
and I want to produce arr which is of type String[]
. What is the most efficient way of doing this?
what kind of items you have in your enum collection…
the enum is from Excel Read Column activity
try this…
(From x in Enumobj.Take(2) select y = x.ToString).ToArray