" var" , ?
-, "-" - , a=>b. - , .
, LINQ, : "" - , .
, :
foreach(var item in result)
Console.WriteLine(item.ToString());
, , = > external.Value.Frequency
. . , - , KeyValuePair int,
static private int MyLambda(KeyValuePair<int, FrequencyAndValue> outer)
{
return outer.Value.Frequency;
}
:
var result = dictionary.OrderByDescending(
new Func<KeyValuePair<int, FrequencyAndValue>, int>(MyLambda));
:
var result = Enumerable.OrderByDescending<KeyValuePair<int, FrequencyAndValue>, int>(
dictionary,
new Func<KeyValuePair<int, FrequencyAndValue>, int>(MyLambda));
var:
IOrderedEnumerable<KeyValuePair<int, FrequencyAndValue>> result =
Enumerable.OrderByDescending<KeyValuePair<int, FrequencyAndValue>, int>(
dictionary,
new Func<KeyValuePair<int, FrequencyAndValue>, int>(MyLambda));
, , , . .
, . : . , ; , " , ".
, . ? . MyLambda , , . , . , .
, - , KeyValuePair int ". ? OrderByDescending().
, ; , .
, #.
.
, OrderByDescending :
static IOrderedEnumerable<T> OrderByDescending<T, K>(
this IEnumerable<T> sequence,
Func<T, K> keyExtractor)
, :
OrderByDescending(dictionary, o=>o.Value.Frequency)
, T K. , . IEnumerable<KeyValuePair<int, FrequencyOrValue>>, , "T, , KeyValuePair<int, FrequencyOrValue>".
, , , . , lambda o=>o.Value.Frequency, , keyExtractor Func<KeyValuePair<int, FrequencyOrValue>, K>, K. , , , :
(KeyValuePair<int, FrequencyOrValue> o)=>{return o.Value.Frequency;}
, ? ! . , , , return int.
, K int, .
; . . "" , .
http://blogs.msdn.com/ericlippert/archive/tags/Type+Inference/default.aspx
, , , :
http://blogs.msdn.com/ericlippert/archive/2006/11/17/a-face-made-for-email-part-three.aspx