public
class
Item
{
public
string
key;
public
string
value;
}
此时不能直接将List<Item>绑定到ComboBox
cob.DataSource = items.itemCollection;
cob.DisplayMember =
"Value"
;
cob.ValueMember =
"Key"
;
必须将Item类修改为
public
class
Item
{
private
string
key;
public
string
Key
{
get
{
return
key; }
set
{ key = value; }
}
private
string
value;
public
string
Value
{
get
{
return
this
.value; }
set
{
this
.value = value; }
}
}