* Robert Scheer <(E-Mail Removed)>:
> I am trying to understand how to use the Array.TakeWhile operator. In
> my tests below, the first Array is filled but the second one is not:
Btw, this is not an operator but an extension function of Linq and it's
not defined for Array but for Enumerables of all kinds.
> Dim arTemp() As Integer = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
>
> Dim first() As Integer = arTemp.TakeWhile(Function(i) i < 5).ToArray
> Dim second() As Integer = arTemp.TakeWhile(Function(i) i > 5).ToArray
That's exactly the specified behavior, TakeWhile starts at the first
element and stops when it finds one that doesn't fulfill your predicate.
0 clearly is NOT bigger than 5
I /guess/ you are actually looking for the Where() function
Regards, Felix
--
Felix Palmen (Zirias) + [PGP] Felix Palmen <(E-Mail Removed)>
web:
http://palmen-it.de/ |
http://palmen-it.de/pub.txt
my open source projects: | Fingerprint: ED9B 62D0 BE39 32F9 2488
http://palmen-it.de/?pg=pro + 5D0C 8177 9D80 5ECF F683