public class test{
private string name = @"aa";
public override string to string{
retrun this.name;
}
}
private testobj = new test();
this.mylistbox.items.add(testobj);
testobj.name = @"bb";
这时候在LISTBOX里还是显示aa,怎么才能显示BB啊??
private string name = @"aa";
public override string to string{
retrun this.name;
}
}
private testobj = new test();
this.mylistbox.items.add(testobj);
testobj.name = @"bb";
这时候在LISTBOX里还是显示aa,怎么才能显示BB啊??
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
{
InitializeComponent();
Test testobj = new Test();
this.listBox1.Items.Add(testobj.Name.ToString());
}
private void button1_Click(object sender, EventArgs e)
{
this.listBox1.Items[0] = @"bb";
}
public class Test
{
private string name = @"aa";
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
}这个可以实现的功能是不是你想要的