Prev | Current Page 300 | Next

Satheesh, N Kumar

"LINQ Quickly"


public static IEnumerable TakeWhile
(
IEnumerable source,
Func predicate
)
Following is a declaration similar to the above declaration, but the integer used in the
predicate function is the element index in the sequence.
public static IEnumerable TakeWhile
(
IEnumerable source,
Func predicate
)
Chapter 7
[ 209 ]
The following code takes all the items from a list, while the item with price more
than 10 is reached. Here, you can see the descending order on the price of the items
list to get all the items with price less than or equal to 10.
List items = GetItemsList();
List icecreamsWithLesserPrice = from itms in items
orderby itms.Price descending
select itms;
List topicecreamsWithLesserPrice = icecreamsWithLesserPrice.
TakeWhile(item => item.Price <= 10);
Console.WriteLine("Items with lesser price");
foreach (Item ItemswithLowPrice in icecreamsWithLesserPrice)
Console.WriteLine("Icecream Name: " + ItemswithLowPrice.


Pages:
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
pozycjonowanie niderlandy typy bukmacherskie życzenia katalog stron