If i do
for (int i = 0; i < appSettings.Count; i++)
{
string key = appSettings.Keys[i];
euFileDictionary.Add(key, appSettings[i]);
}
It is working fine.
When I try to use the same using
Enumerable.Range(0, appSettings.Count).Select(i =>
{
string Key = appSettings.Keys[i];
string Value = appSettings[i];
euFileDictionary.Add(Key, Value);
}).ToDictionary<string,string>();
I get a compile time error
Type arguments to the method "System.Linq.Enumerable.Select (System.Collections.Generic.IEnumerable, System.Func)" cannot be taken out of use. Try explicitly specifying type arguments.
Any idea?
Using C # 3.0
thank
source
share