c# - Set object's nested object's proerty as combo valuemember -


i have combobox. datasource list of objects. class has public property class defined me. set combo's valuemember property of class. how can that?

class b { public int id {get; set;} }  class { public b anyproperty {get; set;} public string name {get; set;} }  var testlist = new list<a>() {...}; combo.datasource = testlist; combo.displaymemver = "name"; combo.valuemember = ??? //it should a.anyproperty.id 

.net4/vs2010/c#

thx

combo.valuemember = "anyproperty"; 

combobox bind object. can value doing this.

var selectedvalue = (b)combobox.selectvalue; 

please not above sytax maybe incorrect.


Comments