たとえば、次のクラス宣言のインスタンスがあります。
public class Person
{
public string Name = "";
public Dictionary<string, string> Properties = new Dictionary<string, string>();
}
そして、Asp.NETドロップダウンリストにバインドしたい人のリストがあります。
List<Person> people = new List<Person>();
//fill the list etc..
//bind to the drop down list
ddlPeople.DataSource = people;
ddlPeople.DataTextField = "Name";
ddlPeople.DataTextField = "Properties['Age']"; //this is what I would like!
年齢は常に存在します。私は人のクラスを制御できません。私がやろうとしていることが達成可能かどうか誰かが知っていますか?
ありがとう!