Dictionary<string,string> to Dictionary<Control,object> using IEnumerable<T>.Select()
- by abatishchev
I have a System.Collections.Generic.Dictionary<string, string> containing control ID and appropriate data column to data bind:
var dic = new Dictionary<string, string>
{
{ "Label1", "FooCount" },
{ "Label2", "BarCount" }
};
I use it that way:
var row = ((DataRowView)FormView1.DataItem).Row;
Dictionary<Control, object> newOne = dic.ToDictionary(
k => FormView1.FindControl(k.Key)),
k => row[k.Value]);
So I'm using IEnumerable<T>.ToDictionary(Func<T>, Func<T>).
Is it possbile to do the same using IEnumerable<T>.Select(Func<T>) ?