Prev | Current Page 281 | Next

Satheesh, N Kumar

"LINQ Quickly"

If the source is null, an ArgumentNullException is thrown.
Standard Query Operators
[ 194 ]
Following is an example that shows how to get the categories of items in an array
using the ToArray operator.
List items = GetItemsList();
string[] icecreamNames = items.Select(itm =>
itm.Category).Distinct().ToArray();
foreach (string nam in icecreamNames)
Console.WriteLine(name);
ToDictionary
The ToDictionary operator creates a dictionary from a given sequence. Following is
the declaration of the ToDictionary operator.
public static Dictionary ToDictionary
(
IEnumerable source,
Func keySelector
)
public static Dictionary ToDictionary
(
IEnumerable source,
Func keySelector,
IEqualityComparer comparer
)
public static Dictionary
ToDictionary
(
IEnumerable source,
Func keySelector,
Func elementSelector
)
public static Dictionary
ToDictionary
(
IEnumerable source,
Func keySelector,
Func elementSelector,
IEqualityComparer comparer
)
The KeySelector and ElementsSelector functions are useful for creating a keyvalue
pair for the dictionary.


Pages:
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
buchsbaum twarożek ze szczypiorkiem miller www.buciki.edu.pl lampy ogrodowe