Prev | Current Page 262 | Next

Satheesh, N Kumar

"LINQ Quickly"

The resultSelector
argument specifies a function that creates a result element from two matching outer
and inner sequence elements. It first enumerates the inner sequence and collects
the elements and their keys using innerKeySelector. It then enumerates the
outer sequence to collect the elements and their keys using the outerKeySelector
function. Using these selections, the resultSelector is evaluated for the resulting
sequence. It also maintains the order of the elements in sequences.
The following code is an example for joining categories with items having
category as the key between these two sequences. The result is a combination of
categories, items, and ingredients.
List items = GetItemsList();
List categories = GetCategoriesList();
var CategoryItems = categories.Join(items,
category => category.Category,
item => item.Category,
(category, item) => new { Category = category.Category, Item =
Chapter 7
[ 181 ]
item.Name, Ingr = item.Ingredients });
foreach (var str in CategoryItems)
{
Console.


Pages:
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
dieta light Connie Talbot portal życzenia z okazji urodzin Unibet