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:
protected void FormView1_DataBound(object sender, EventArgs e)
{
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>)
?