You are looking for something like this:
IEnumerable<float> vals = enumeration.Where( d => d.ContainsKey( "some key" ) )
.Select( d => d["some key"] );
This query first determines which dictionaries in the sequence contain the specified key, and then for each of them retrieves the value for the given key.
, , TryGetValue(), - Where, Select. , , , . .
public static class DictionaryExt {
public static TValue FindOrDefault<TKey,TValue>(
this Dictionary<TKey,TValue> dic,
TKey key, TValue defaultValue )
{
TValue val;
return dic.TryGetValue( key, out val ) ? val : defaultValue;
}
}
enumeration.Select( d => d.FindOrDefault( "some key", float.NaN ) )
.Where ( f => f != float.NaN );